Changeset 4460

Show
Ignore:
Timestamp:
Tue Feb 21 21:48:43 2006
Author:
mugur
Message:

fixed ticket:1619 - Subscribe by language

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/campsite/implementation/utils/campsite-create-instance.php

    r4435 r4460  
    271 271                 $version = "2.4.x";  
    272 272             }  
    273               if (!$res2 = mysql_query("SELECT * FROM UserConfig WHERE `fk_user_id` = 0"))  
      273             if (!$res2 = mysql_query("DESC SubsSections IdLanguage"))  
    273 273                 return "Unable to query the database $p_db_name";  
    274 274             if (mysql_num_rows($res2) > 0) {  
  • trunk/campsite/implementation/database/upgrade/2.4.x/tables.sql

    r4422 r4460  
    3 3 ALTER  TABLE  `ArticleImages`  ADD  INDEX  `IdImage` (  `IdImage`  ) ;  
    4 4  
      5 -- add IdLanguage column to SubsSections table  
      6 ALTER TABLE SubsSections DROP PRIMARY KEY;  
      7 ALTER TABLE SubsSections ADD COLUMN IdLanguage int(10) NOT NULL DEFAULT 0 AFTER SectionNumber;  
      8 ALTER TABLE SubsSections ADD PRIMARY KEY (IdSubscription, SectionNumber, IdLanguage);  
      9  
      10 -- update the subscription fields in the publications table  
      11 ALTER TABLE Publications DROP COLUMN PayTime;  
      12 ALTER TABLE Publications ADD COLUMN UnitCostAllLang float(10, 2) unsigned NOT NULL DEFAULT 0 AFTER UnitCost;  
      13 UPDATE Publications SET UnitCostAllLang = UnitCost;  
      14  
      15 -- add settings option  
    5 16 INSERT INTO UserConfig(`fk_user_id`, `varname`, `value`) VALUES (0, 'KeywordSeparator', ',');  
    6 17  
  • trunk/campsite/implementation/management/priv/lang/ro/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "");  
    3 12 regGS("Go To Issues", "");  
     
    20 29 regGS("Adding new publication", "Adaug publicaţie");  
    21 30 regGS("The publication could not be added.", "Publicaţia nu poate fi adăugată");  
    22   regGS("Select the publication", "Selectaţi publicaţia");  
    23 31 regGS("Add new country default subscription time", "Adaugă timp implicit de subscriere la ţară");  
    24 32 regGS("You do not have the right to manage publications.", "Nu aveţi dreptul de a modifica publicaţii");  
    31 39 regGS("Are you sure you want to delete the subscription default time for $1?", "Doriţi să ştergeţi timpul implicit de subscriere la ţara $1?");  
    32 40 regGS("Subscription default time for $1 deleted", "Timpul implicit de subscriere la ţara $1 a fost şters");  
    33   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Nume");  
    34 41 ?>  
  • trunk/campsite/implementation/management/priv/lang/ro/home.php

    r4204 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "");  
    3 4 regGS("There are no pending items to be published.", "");  
  • trunk/campsite/implementation/management/priv/lang/zh/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "");  
    3 12 regGS("Go To Issues", "");  
     
    20 29 regGS("Adding new publication", "添加新出版物");  
    21 30 regGS("The publication could not be added.", "不能添加出版物");  
    22   regGS("Select the publication", "选择出版物");  
    23 31 regGS("Add new country default subscription time", "增加新国家的默认订阅时间");  
    24 32 regGS("You do not have the right to manage publications.", "您无权管理出版物");  
    30 38 regGS("Are you sure you want to delete the subscription default time for $1?", "您确定要删除$1的默认订阅时间?");  
    31 39 regGS("Subscription default time for $1 deleted", "$1的默认订阅时间已删除");  
    32   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "名称(单击选择发布)");  
    33 40 ?>  
  • trunk/campsite/implementation/management/priv/lang/zh/home.php

    r3953 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("Please enter your user name and password", "请输入用户名与密码");  
    3 4 regGS("You do not have the right to access this page.", "你无权限访问此页面");  
  • trunk/campsite/implementation/management/priv/lang/ar/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "");  
    3 12 regGS("Go To Issues", "");  
     
    25 34 regGS("Adding new publication", "إضافة منشور جديد");  
    26 35 regGS("The publication could not be added.", "لا يمكن إضافة المنشور");  
    27   regGS("Select the publication", "اختر المنشور");  
    28 36 regGS("Add new country default subscription time", "أضف مدّة الاشتراك الأصلية خاصة بالبلد الجديد");  
    29 37 regGS("You do not have the right to manage publications.", "لا يحق لك إدارة المنشورات");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "هل أنت متأكد من أنك تريد إلغاء مدّة الاشتراك الأصلية لـ $1 ؟");  
    37 45 regGS("Subscription default time for $1 deleted", "تمّ الغاء مدّة الاشتراك الأصلية لـ $1");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "الاسم (اضغط هنا لاختيار المنشور");  
    39 46 regGS("Add new alias", "أضف اسم مستعار جديد");  
    40 47 regGS("Alias (click to edit)", "الاسم المستعار ( اضغط للتعديل)");  
  • trunk/campsite/implementation/management/priv/lang/ar/home.php

    r4294 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "");  
    3 4 regGS("There are no pending items to be published.", "");  
  • trunk/campsite/implementation/management/priv/lang/en/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "trial subscription");  
      3 regGS("paid subscription", "paid subscription");  
      4 regGS("time units", "time units");  
      5 regGS("one language", "one language");  
      6 regGS("all languages", "all languages");  
      7 regGS("Trial subscriptions", "Trial subscriptions");  
      8 regGS("Time unit cost per one section", "Time unit cost per one section");  
      9 regGS("Paid subscriptions", "Paid subscriptions");  
      10 regGS("Default time period", "Default time period");  
    2 11 regGS("Publication List", "Publication List");  
    3 12 regGS("Go To Issues", "Go To Issues");  
     
    25 34 regGS("Adding new publication", "Adding new publication");  
    26 35 regGS("The publication could not be added.", "The publication could not be added.");  
    27   regGS("Select the publication", "Select the publication");  
    28 36 regGS("Add new country default subscription time", "Add new country default subscription time");  
    29 37 regGS("You do not have the right to manage publications.", "You do not have the right to manage publications.");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "Are you sure you want to delete the subscription default time for $1?");  
    37 45 regGS("Subscription default time for $1 deleted", "Subscription default time for $1 deleted");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Name<BR><SMALL>(click to select the publication)</SMALL>");  
    39 46 regGS("Add new alias", "Add new alias");  
    40 47 regGS("Alias (click to edit)", "Alias (click to edit)");  
  • trunk/campsite/implementation/management/priv/lang/en/home.php

    r3953 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "System Preferences");  
    2 3 regGS("You haven't written any articles yet.", "You haven't written any articles yet.");  
    3 4 regGS("There are no pending items to be published.", "There are no pending items to be published.");  
  • trunk/campsite/implementation/management/priv/lang/pt/pub.php

    r4292 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "Lista de Publicações");  
    3 12 regGS("Go To Issues", "Ir para edições");  
     
    25 34 regGS("Adding new publication", "Criar Publicação");  
    26 35 regGS("The publication could not be added.", "A Publicação não pode ser Criada");  
    27   regGS("Select the publication", "Escolha a Publicação");  
    28 36 regGS("Add new country default subscription time", "Adicionar tempo de Assinatura para Pais");  
    29 37 regGS("You do not have the right to manage publications.", "Não tem permissões para gerir Publicações");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "Confirma o apagamento do tempo de Assinatura");  
    37 45 regGS("Subscription default time for $1 deleted", "Tempo de Assinatura para $1 foi apagado");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Nome (Carregue para selecionar Publicação)");  
    39 46 regGS("Add new alias", "Adicionar novo Alias");  
    40 47 regGS("Alias (click to edit)", "Alias (carregue para editar)");  
  • trunk/campsite/implementation/management/priv/lang/pt/home.php

    r4292 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "Ainda não escreveu artigos.");  
    3 4 regGS("There are no pending items to be published.", "Nao existem itens pendentes para publicação.");  
  • trunk/campsite/implementation/management/priv/lang/at/pub.php

    r4307 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "Liste der Publikationen");  
    3 12 regGS("Go To Issues", "Gehe zu Ausgabe");  
     
    25 34 regGS("Adding new publication", "Neue Publikatin hinzufügen");  
    26 35 regGS("The publication could not be added.", "Publikation konnte nicht hinzugefügt werden");  
    27   regGS("Select the publication", "Publikation auswählen");  
    28 36 regGS("Add new country default subscription time", "Neue Länderstandardzeit für Abonoments hinzufügen");  
    29 37 regGS("You do not have the right to manage publications.", "Keine Berechtigung, die Publikation zu verändern");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "Sicher, die Abonomentstandardzeit  für $1 zu löschen?");  
    37 45 regGS("Subscription default time for $1 deleted", "Abonomentstandardzeit  für $1 gelöscht");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Name (Publikation auswählen, bitte anklicken)");  
    39 46 regGS("Add new alias", "Neuen Alias hinzufügen");  
    40 47 regGS("Alias (click to edit)", "Alias (anklicken zum editieren)");  
  • trunk/campsite/implementation/management/priv/lang/at/home.php

    r4307 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "Sie haben noch keine Artikel geschrieben.");  
    3 4 regGS("There are no pending items to be published.", "Es existieren keine Artikel, die auf ihre Veröffentlichung warten.");  
  • trunk/campsite/implementation/management/priv/lang/sr/pub.php

    r4250 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "Листа публикација");  
    3 12 regGS("Go To Issues", "Иди на издања");  
     
    25 34 regGS("Adding new publication", "Додавање нове публикације");  
    26 35 regGS("The publication could not be added.", "Публикација не може бити додата");  
    27   regGS("Select the publication", "Изаберите публикацију");  
    28 36 regGS("Add new country default subscription time", "Додај нови основни период претплате за државу");  
    29 37 regGS("You do not have the right to manage publications.", "Немате право да администрирате публикацијама");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "Сигурни сте да желите да обришете основну дужину претплате за $1?");  
    37 45 regGS("Subscription default time for $1 deleted", "Дужина претплате за $1 је избрисана");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Назив<br><small>(кликните за избор публикације)</small>");  
    39 46 regGS("Add new alias", "Додај нови алиас");  
    40 47 regGS("Alias (click to edit)", "Алиас (клик за уређивање)");  
  • trunk/campsite/implementation/management/priv/lang/sr/home.php

    r3953 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "Нема ваших чланака.");  
    3 4 regGS("There are no pending items to be published.", "Нема ставки за објављивање.");  
  • trunk/campsite/implementation/management/priv/lang/ru/pub.php

    r4291 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "Список публикаций");  
    3 12 regGS("Go To Issues", "Перейти к выпускам");  
     
    25 34 regGS("Adding new publication", "Добавление новой публикации");  
    26 35 regGS("The publication could not be added.", "Не удалось добавить публикацию.");  
    27   regGS("Select the publication", "Выберите публикацию");  
    28 36 regGS("Add new country default subscription time", "Добавить время подписки по умолчанию для новой страны");  
    29 37 regGS("You do not have the right to manage publications.", "Вы не имеете права управления публикациями");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "Вы уверены, что хотите удалить время подпискипо умолчанию для $1?");  
    37 45 regGS("Subscription default time for $1 deleted", "Время подписки по умолчанию для $1 удалено");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Название<BR><SMALL>(щелкните для выбора выпуска)</SMALL>");  
    39 46 regGS("Add new alias", "Добавить новый псевдоним");  
    40 47 regGS("Alias (click to edit)", "Псевдонимы (щелкните для правки)");  
  • trunk/campsite/implementation/management/priv/lang/ru/home.php

    r3953 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "Вы еще не написали статью.");  
    3 4 regGS("There are no pending items to be published.", "Нет отложенных статей для публикации.");  
  • trunk/campsite/implementation/management/priv/lang/es/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "");  
    3 12 regGS("Go To Issues", "");  
     
    20 29 regGS("Adding new publication", "Agregando nueva publicación");  
    21 30 regGS("The publication could not be added.", "La publicación no pudo ser agregada");  
    22   regGS("Select the publication", "Seleccionar la publicación");  
    23 31 regGS("Add new country default subscription time", "Agregar nuevo país defecto de tiempo de suscripción");  
    24 32 regGS("You do not have the right to manage publications.", "No tiene derecho a manejar las publicaciones");  
    31 39 regGS("Are you sure you want to delete the subscription default time for $1?", "¿Esta seguro que desea borrar tiempo defecto de suscripción para $1?");  
    32 40 regGS("Subscription default time for $1 deleted", "Tiempo defecto de suscripción para $1 borrado");  
    33   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Nombre");  
    34 41 ?>  
  • trunk/campsite/implementation/management/priv/lang/es/home.php

    r3953 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("Please enter your user name and password", "Por favor entre su nombre de usuario y clave");  
    3 4 regGS("You do not have the right to access this page.", "No tiene derecho para accesar esta pagina.");  
  • trunk/campsite/implementation/management/priv/lang/fr/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "");  
    3 12 regGS("Go To Issues", "");  
     
    25 34 regGS("Adding new publication", "");  
    26 35 regGS("The publication could not be added.", "");  
    27   regGS("Select the publication", "");  
    28 36 regGS("Add new country default subscription time", "");  
    29 37 regGS("You do not have the right to manage publications.", "");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "");  
    37 45 regGS("Subscription default time for $1 deleted", "");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "");  
    39 46 regGS("Add new alias", "");  
    40 47 regGS("Alias (click to edit)", "");  
  • trunk/campsite/implementation/management/priv/lang/fr/home.php

    r4037 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "");  
    3 4 regGS("There are no pending items to be published.", "");  
  • trunk/campsite/implementation/management/priv/lang/de/pub.php

    r4306 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "Liste der Publikationen");  
    3 12 regGS("Go To Issues", "Gehe zu Ausgabe");  
     
    25 34 regGS("Adding new publication", "Neue Publikatin hinzufügen");  
    26 35 regGS("The publication could not be added.", "Publikation konnte nicht hinzugefügt werden");  
    27   regGS("Select the publication", "Publikation auswählen");  
    28 36 regGS("Add new country default subscription time", "Neue Länderstandardzeit für Abonoments hinzufügen");  
    29 37 regGS("You do not have the right to manage publications.", "Keine Berechtigung, die Publikation zu verändern");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "Sicher, die Abonomentstandardzeit  für $1 zu löschen?");  
    37 45 regGS("Subscription default time for $1 deleted", "Abonomentstandardzeit  für $1 gelöscht");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Name (Publikation auswählen, bitte anklicken)");  
    39 46 regGS("Add new alias", "Neuen Alias hinzufügen");  
    40 47 regGS("Alias (click to edit)", "Alias (anklicken zum editieren)");  
  • trunk/campsite/implementation/management/priv/lang/de/home.php

    r4306 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "Sie haben noch keine Artikel geschrieben.");  
    3 4 regGS("There are no pending items to be published.", "Es existieren keine Artikel, die auf ihre Veröffentlichung warten.");  
  • trunk/campsite/implementation/management/priv/lang/hr/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "");  
    3 12 regGS("Go To Issues", "");  
    29 38 regGS("Are you sure you want to delete the subscription default time for $1?", "Da li ste sigurni da želite izbrisati standardno trajanje pretplate za publikaciju $1");  
    30 39 regGS("Subscription default time for $1 deleted", "Standardno trajanje pretplate za publikaciju $1 je izbrisano");  
    31   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Ime<br><small>(kliknite za odabir publikacije)</small>");  
    32 40 ?>  
  • trunk/campsite/implementation/management/priv/lang/hr/home.php

    r4293 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "");  
    3 4 regGS("There are no pending items to be published.", "");  
  • trunk/campsite/implementation/management/priv/lang/sh/pub.php

    r4251 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "Lista publikacija");  
    3 12 regGS("Go To Issues", "Idi na izdanja");  
     
    25 34 regGS("Adding new publication", "Dodavanje nove publikacije");  
    26 35 regGS("The publication could not be added.", "Publikacija ne može biti dodata.");  
    27   regGS("Select the publication", "Izaberite publikaciju");  
    28 36 regGS("Add new country default subscription time", "Dodaj novi osnovni period pretplate za državu");  
    29 37 regGS("You do not have the right to manage publications.", "Nemate pravo da administrirate publikacijama.");  
    36 44 regGS("Are you sure you want to delete the subscription default time for $1?", "Sigurni ste da želite da obrišete osnovnu dužinu pretplate za $1?");  
    37 45 regGS("Subscription default time for $1 deleted", "Dužina pretplate za $1 je izbrisana");  
    38   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Naziv<br><small>(kliknite za izbor publikacije)</small>");  
    39 46 regGS("Add new alias", "Dodaj novi alias");  
    40 47 regGS("Alias (click to edit)", "Alias (klik za uređivanje)");  
  • trunk/campsite/implementation/management/priv/lang/sh/home.php

    r3953 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "Nema vaših članaka.");  
    3 4 regGS("There are no pending items to be published.", "Nema stavki za objavljivanje.");  
  • trunk/campsite/implementation/management/priv/lang/cz/pub.php

    r4160 r4460  
    1 1 <?php  
      2 regGS("trial subscription", "");  
      3 regGS("paid subscription", "");  
      4 regGS("time units", "");  
      5 regGS("one language", "");  
      6 regGS("all languages", "");  
      7 regGS("Trial subscriptions", "");  
      8 regGS("Time unit cost per one section", "");  
      9 regGS("Paid subscriptions", "");  
      10 regGS("Default time period", "");  
    2 11 regGS("Publication List", "");  
    3 12 regGS("Go To Issues", "");  
     
    20 29 regGS("Adding new publication", "Přidat novou publikaci");  
    21 30 regGS("The publication could not be added.", "Publikace nemohla být přidána");  
    22   regGS("Select the publication", "Vyberte publikaci");  
    23 31 regGS("Add new country default subscription time", "Přidat předplatné období pro novou zemi");  
    24 32 regGS("You do not have the right to manage publications.", "Nemáte právo spravovat publikace");  
    30 38 regGS("Are you sure you want to delete the subscription default time for $1?", "Určitě chcete smazat předplatné období pro $1?");  
    31 39 regGS("Subscription default time for $1 deleted", "Předplatné období pro $1 bylo smazáno");  
    32   regGS("Name<BR><SMALL>(click to select the publication)</SMALL>", "Název (klikněte pro výběr publikace)");  
    33 40 ?>  
  • trunk/campsite/implementation/management/priv/lang/cz/home.php

    r4289 r4460  
    1 1 <?php  
      2 regGS("System Preferences", "");  
    2 3 regGS("You haven't written any articles yet.", "");  
    3 4 regGS("There are no pending items to be published.", "");  
  • trunk/campsite/implementation/management/priv/pub/do_edit.php

    r4169 r4460  
    24 24 $cLanguage = Input::Get('cLanguage', 'int');  
    25 25 $cURLType = Input::Get('cURLType', 'int');  
    26   $cPayTime = Input::Get('cPayTime', 'int');  
    27 26 $cTimeUnit = Input::Get('cTimeUnit');  
    28 27 $cUnitCost = trim(Input::Get('cUnitCost', 'float', '0.0'));  
      28 $cUnitCostAllLang = trim(Input::Get('cUnitCostAllLang', 'float', '0.0'));  
    29 29 $cCurrency = trim(Input::Get('cCurrency'));  
    30 30 $cPaid = Input::Get('cPaid', 'int');  
     
    35 35 if (empty($cName)) {  
    36 36     $correct = false;  
    37       $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Name').'</B>');   
      37     $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Name').'</B>');  
    37 37 }  
    38 38 if (empty($cDefaultAlias)) {  
    39 39     $correct = false;  
    40       $errorMsgs = getGS('You must complete the $1 field.','<B>'.getGS('Site').'</B>');   
      40     $errorMsgs = getGS('You must complete the $1 field.','<B>'.getGS('Site').'</B>');  
    40 40 }  
    41 41  
     
    48 48                      'IdDefaultLanguage' => $cLanguage,  
    49 49                      'IdURLType' => $cURLType,  
    50                        'PayTime' => $cPayTime,  
    51 50                      'TimeUnit' => $cTimeUnit,  
    52 51                      'PaidTime' => $cPaid,  
    53 52                      'TrialTime' => $cTrial,  
    54 53                      'UnitCost' => $cUnitCost,  
      54                      'UnitCostAllLang' => $cUnitCostAllLang,  
    55 55                      'Currency' => $cCurrency);  
    56 56     $updated = $publicationObj->update($columns);  
    57   //  if ($updated) {  
      57     if ($updated) {  
    57 57         header("Location: /$ADMIN/pub/edit.php?Pub=$Pub");  
    58 58         exit;  
    59   //  }  
    60   //  else {  
    61   //      $errorMsgs[] = getGS('The publication information could not be updated.')  
    62   //                    .' '.getGS('Please check if another publication with the same name or the same site name does not already exist.');  
    63   //  }  
      59     } else {  
      60         $errorMsgs[] = getGS('The publication information could not be updated.')  
      61                       .' '.getGS('Please check if another publication with the same name or the same site name does not already exist.');  
      62     }  
    64 63 }  
    65 64  
    79 78     <TD COLSPAN="2">  
    80 79         <BLOCKQUOTE>  
    81           <?php   
      80         <?php  
    81 80         foreach ($errorMsgs as $errorMsg) { ?>  
    82 81             <li><?php p($errorMsg); ?> </li>  
  • trunk/campsite/implementation/management/priv/pub/do_add.php

    r4169 r4460  
    19 19 $cLanguage = Input::Get('cLanguage', 'int');  
    20 20 $cURLType = Input::Get('cURLType', 'int', 0);  
    21    
    22   $cPayTime = Input::Get('cPayTime', 'int', 0, true);  
    23 21 $cTimeUnit = Input::Get('cTimeUnit', 'string', null, true);  
    24 22 $cUnitCost = Input::Get('cUnitCost', 'string', null, true);  
      23 $cUnitCostAllLang = Input::Get('cUnitCostAllLang', 'string', null, true);  
    25 24 $cCurrency = Input::Get('cCurrency', 'string', null, true);  
    26 25 $cPaid = Input::Get('cPaid', 'int', null, true);  
     
    30 29 $created = false;  
    31 30 $errorMsgs = array();  
    32        
      31  
    32 31 if (empty($cName)) {  
    33 32     $correct = false;  
    34       $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Name').'</B>');   
      33     $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Name').'</B>');  
    34 33 }  
    35 34  
    36 35 if (empty($cSite)) {  
    37 36     $correct = false;  
    38       $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Site').'</B>');   
      37     $errorMsgs[] = getGS('You must complete the $1 field.','<B>'.getGS('Site').'</B>');  
    38 37 }  
    39 38  
     
    47 46         $alias->create(array('Name' => $cSite));  
    48 47         $newPub =& new Publication();  
    49           $columns = array('Name' => $cName,  
    50                            'IdDefaultAlias'=> $alias->getId(),  
      48         $columns = array('Name' => $cName,  
      49                          'IdDefaultAlias'=> $alias->getId(),  
    51 50                          'IdDefaultLanguage' => $cLanguage,  
    52 51                          'IdURLType' => $cURLType,  
    53                            'PayTime' => $cPayTime,  
    54 52                          'TimeUnit' => $cTimeUnit,  
    55 53                          'UnitCost' => $cUnitCost,  
      54                          'UnitCostAllLang' => $cUnitCostAllLang,  
    56 55                          'Currency' => $cCurrency,  
    57 56                          'PaidTime' => $cPaid,  
     
    76 75 $crumbs[] = array(getGS("Adding new publication"), "");  
    77 76 echo camp_html_breadcrumbs($crumbs);  
    78   ?>   
      77 ?>  
    78 77  
    79 78 <P>  
    89 88     <TD COLSPAN="2">  
    90 89         <BLOCKQUOTE>  
    91           <?php   
      90         <?php  
    91 90         foreach ($errorMsgs as $errorMsg) { ?>  
    92 91             <LI><?php echo $errorMsg; ?></LI>  
  • trunk/campsite/implementation/management/priv/pub/countryadd.php

    r4101 r4460  
    2 2 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/pub/pub_common.php");  
    3 3 require_once($_SERVER['DOCUMENT_ROOT']."/classes/Country.php");  
      4 require_once($_SERVER['DOCUMENT_ROOT']."/classes/TimeUnit.php");  
    4 5  
    5 6 // Check permissions  
     
    18 19 $Language = Input::Get('Language', 'int', 1, true);  
    19 20 $publicationObj =& new Publication($Pub);  
      21 $pubTimeUnit =& new TimeUnit($publicationObj->getTimeUnit(), $publicationObj->getLanguageId());  
      22 if (!$pubTimeUnit->exists()) {  
      23     $pubTimeUnit =& new TimeUnit($publicationObj->getTimeUnit(), 1);  
      24 }  
    20 25  
    21 26 $countries = Country::GetCountries($Language);  
     
    28 33 <FORM NAME="dialog" METHOD="POST" ACTION="do_countryadd.php">  
    29 34 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
    30   <TR>  
    31       <TD COLSPAN="2">  
    32           <B><?php  putGS("Add new country default subscription time"); ?></B>  
    33           <HR NOSHADE SIZE="1" COLOR="BLACK">  
    34       </TD>  
    35   </TR>  
    36 35 <INPUT TYPE=HIDDEN NAME=cPub VALUE="<?php p($Pub); ?>">  
    37 36 <TR>  
     
    39 38     <TD>  
    40 39     <SELECT NAME="cCountryCode" class="input_select">  
    41       <?php   
      40     <?php  
    41 40     foreach ($countries as $country) { ?>  
    42           <OPTION VALUE="<?php  p(htmlspecialchars($country->getCode())); ?>"><?php p(htmlspecialchars($country->getName())); ?>   
    43           <?php  
      41         <OPTION VALUE="<?php  p(htmlspecialchars($country->getCode())); ?>"><?php p(htmlspecialchars($country->getName())); ?>  
      42         <?php  
    44 43     }  
    45 44     ?>  
    48 47     </TD>  
    49 48 </TR>  
      49 <tr>  
      50     <td colspan="2" align="left"><b><?php putGS('Default time period'); ?>:</b></td>  
      51 </tr>  
    50 52 <TR>  
    51       <TD ALIGN="RIGHT" ><?php  putGS("Trial Period"); ?>:</TD>  
      53     <TD ALIGN="RIGHT" >- <?php  putGS("trial subscription"); ?>:</TD>  
    51 53     <TD>  
    52 54     <INPUT TYPE="TEXT" class="input_text" NAME="cTrialTime" VALUE="1" SIZE="5" MAXLENGTH="5">  
      55     <?php p($pubTimeUnit->getName()); ?>  
    53 56     </TD>  
    54 57 </TR>  
    55 58 <TR>  
    56       <TD ALIGN="RIGHT" ><?php  putGS("Paid Period"); ?>:</TD>  
      59     <TD ALIGN="RIGHT" >- <?php  putGS("paid subscription"); ?>:</TD>  
    56 59     <TD>  
    57 60     <INPUT TYPE="TEXT" class="input_text" NAME="cPaidTime" VALUE="1" SIZE="5" MAXLENGTH="5">  
      61     <?php p($pubTimeUnit->getName()); ?>  
    58 62     </TD>  
    59 63 </TR>  
  • trunk/campsite/implementation/management/priv/pub/deftime.php

    r4145 r4460  
    3 3 require_once($_SERVER['DOCUMENT_ROOT']."/classes/SubscriptionDefaultTime.php");  
    4 4 require_once($_SERVER['DOCUMENT_ROOT']."/classes/Country.php");  
      5 require_once($_SERVER['DOCUMENT_ROOT']."/classes/TimeUnit.php");  
    5 6  
    6 7 // Check permissions  
     
    19 20 $Language = Input::Get('Language', 'int', 1);  
    20 21 $publicationObj =& new Publication($Pub);  
      22 $pubTimeUnit =& new TimeUnit($publicationObj->getTimeUnit(), $publicationObj->getLanguageId());  
      23 if (!$pubTimeUnit->exists()) {  
      24     $pubTimeUnit =& new TimeUnit($publicationObj->getTimeUnit(), 1);  
      25 }  
    21 26  
    22 27 $defaultTimes = SubscriptionDefaultTime::GetSubscriptionDefaultTimes(null, $Pub);  
    23 28 camp_html_content_top(getGS("Countries Subscription Default Time"), array("Pub" => $publicationObj));  
    24 29  
    25   ?>     
      30 ?>  
    25 30 <p>  
    26 31 <TABLE class="action_buttons">  
     
    35 40 <TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list">  
    36 41 <TR class="table_list_header">  
    37       <TD ALIGN="LEFT" VALIGN="TOP"  ><B><?php  putGS("Country<BR><SMALL>(click to edit)</SMALL>"); ?></B></TD>  
    38       <TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Trial Period"); ?></B></TD>  
    39       <TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("Paid Period"); ?></B></TD>  
    40       <TD ALIGN="LEFT" VALIGN="TOP" ><B><?php  putGS("Delete"); ?></B></TD>  
      42     <TD ALIGN="LEFT" VALIGN="TOP" rowspan="2"><B><?php  putGS("Country<BR><SMALL>(click to edit)</SMALL>"); ?></B></TD>  
      43     <td colspan="2"><?php putGS('Default time period'); ?> (<?php p($pubTimeUnit->getName()); ?>):</td>  
      44     <TD ALIGN="LEFT" VALIGN="TOP" rowspan="2"><B><?php  putGS("Delete"); ?></B></TD>  
    41 45 </TR>  
    42   <?php   
      46 <tr class="table_list_header">  
      47     <TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("trial subscription"); ?></B></TD>  
      48     <TD ALIGN="LEFT" VALIGN="TOP" nowrap><B><?php  putGS("paid subscription"); ?></B></TD>  
      49 </tr>  
      50 <?php  
    43 51 $color = 0;  
    44   foreach ($defaultTimes as $time) {   
      52 foreach ($defaultTimes as $time) {  
    44 52     $country =& new Country($time->getCountryCode(), $Language);  
    45 53     ?>  
    59 67         </TD>  
    60 68     </TR>  
    61   <?php  
    62   }  
      69 <?php  
      70 }  
    63 71 ?>  <TR><TD COLSPAN="2" NOWRAP>  
    64 72 </TABLE>  
  • trunk/campsite/implementation/management/priv/pub/editdeftime.php

    r4101 r4460  
    3 3 require_once($_SERVER['DOCUMENT_ROOT']."/classes/SubscriptionDefaultTime.php");  
    4 4 require_once($_SERVER['DOCUMENT_ROOT']."/classes/Country.php");  
      5 require_once($_SERVER['DOCUMENT_ROOT']."/classes/TimeUnit.php");  
    5 6  
    6 7 // Check permissions  
     
    20 21 $CountryCode = Input::Get('CountryCode');  
    21 22 $publicationObj =& new Publication($Pub);  
      23 $pubTimeUnit =& new TimeUnit($publicationObj->getTimeUnit(), $publicationObj->getLanguageId());  
      24 if (!$pubTimeUnit->exists()) {  
      25     $pubTimeUnit =& new TimeUnit($publicationObj->getTimeUnit(), 1);  
      26 }  
    22 27  
    23 28 $defaultTime =& new SubscriptionDefaultTime($CountryCode, $Pub);  
     
    31 36 <FORM NAME="dialog" METHOD="POST" ACTION="do_editdeftime.php"  >  
    32 37 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
    33   <TR>  
    34       <TD COLSPAN="2">  
    35           <B><?php  putGS("Change subscription default time"); ?></B>  
    36           <HR NOSHADE SIZE="1" COLOR="BLACK">  
    37       </TD>  
    38   </TR>  
    39 38 <INPUT TYPE=HIDDEN NAME="Pub" VALUE="<?php p($Pub); ?>">  
    40 39 <INPUT TYPE=HIDDEN NAME="CountryCode" VALUE="<?php p($CountryCode); ?>">  
    46 45     </TD>  
    47 46 </TR>  
      47 <tr>  
      48     <td colspan="2" align="left"><b><?php putGS('Default time period'); ?>:</b></td>  
      49 </tr>  
    48 50 <TR>  
    49       <TD ALIGN="RIGHT" ><?php  putGS("Trial Period"); ?>:</TD>  
      51     <TD ALIGN="RIGHT" >- <?php  putGS("trial subscription"); ?>:</TD>  
    49 51     <TD>  
    50 52     <INPUT TYPE="TEXT" NAME="cTrialTime" VALUE="<?php p($defaultTime->getTrialTime()); ?>" SIZE="5" MAXLENGTH="5">  
      53     <?php p($pubTimeUnit->getName()); ?>  
    51 54     </TD>  
    52 55 </TR>  
    53 56 <TR>  
    54       <TD ALIGN="RIGHT" ><?php  putGS("Paid Period"); ?>:</TD>  
      57     <TD ALIGN="RIGHT" >- <?php  putGS("paid subscription"); ?>:</TD>  
    54 57     <TD>  
    55 58     <INPUT TYPE="TEXT" NAME="cPaidTime" VALUE="<?php p($defaultTime->getPaidTime()); ?>" SIZE="5" MAXLENGTH="5">  
      59     <?php p($pubTimeUnit->getName()); ?>  
    56 60     </TD>  
    57 61 </TR>  
  • trunk/campsite/implementation/management/priv/pub/edit.php

    r4249 r4460  
    34 34  
    35 35 echo camp_html_content_top(getGS("Configure publication"), array("Pub" => $publicationObj));  
    36   ?>   
      36 ?>  
    36 36 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons" style="padding-top: 5px;">  
    37 37 <TR>  
     
    66 66 <FORM NAME="dialog" METHOD="POST" ACTION="do_edit.php"  >  
    67 67 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
    68   <TR>  
    69       <TD COLSPAN="2">  
    70           <B><?php  putGS("Configure publication"); ?></B>  
    71           <HR NOSHADE SIZE="1" COLOR="BLACK">  
    72       </TD>  
    73   </TR>  
    74   <tr><td colspan=2><b><?php putGS("General attributes"); ?></b></td></tr>  
      68 <tr><td colspan=2><font size="+1"><b><?php putGS("General attributes"); ?></b></font></td></tr>  
    75 69 <TR>  
    76 70     <TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>  
     
    85 79         <?php  
    86 80             foreach ($aliases as $alias) {  
    87                   camp_html_select_option($alias->getId(), $publicationObj->getDefaultAliasId(), $alias->getName());       
      81                 camp_html_select_option($alias->getId(), $publicationObj->getDefaultAliasId(), $alias->getName());  
    87 81             }  
    88 82         ?>  
     
    96 90     <TD>  
    97 91     <SELECT NAME="cLanguage" class="input_select">  
    98       <?php   
      92     <?php  
    98 92     foreach ($languages as $language) {  
    99 93         camp_html_select_option($language->getLanguageId(), $publicationObj->getDefaultLanguageId(), $language->getNativeName());  
     
    119 113  
    120 114 <tr><td colspan=2><HR NOSHADE SIZE="1" COLOR="BLACK"></td></tr>  
    121   <tr><td colspan=2><b><?php putGS("Subscriptions defaults"); ?></b></td></tr>  
    122   <TR>  
    123       <TD ALIGN="RIGHT" ><?php  putGS("Pay Period"); ?>:</TD>  
    124       <TD>  
    125       <INPUT TYPE="TEXT" class="input_text" NAME="cPayTime" VALUE="<?php p(htmlspecialchars($publicationObj->getPayTime())); ?>" SIZE="5" MAXLENGTH="5"> <?php  p($pubTimeUnit->getName()); ?>  
    126       </TD>  
    127   </TR>  
      115 <tr><td colspan=2><font size="+1"><b><?php putGS("Subscriptions defaults"); ?></b></font></td></tr>  
    128 116 <TR>  
    129 117     <TD ALIGN="RIGHT" ><?php  putGS("Time Unit"); ?>:</TD>  
    130 118     <TD>  
    131 119     <SELECT NAME="cTimeUnit" class="input_select">  
    132       <?php   
      120     <?php  
    132 120     foreach ($timeUnits as $timeUnit) {  
    133 121         camp_html_select_option($timeUnit->getUnit(), $publicationObj->getTimeUnit(), $timeUnit->getName());  
     
    138 126     </TD>  
    139 127 </TR>  
      128 <tr>  
      129     <td colspan="2" align="left"><b><?php putGS('Paid subscriptions'); ?></b></td>  
      130 </tr>  
    140 131 <TR>  
    141       <TD ALIGN="RIGHT" ><?php  putGS("Unit Cost"); ?>:</TD>  
      132     <TD ALIGN="RIGHT" ><?php  putGS("Currency"); ?>:</TD>  
      133     <TD>  
      134     <INPUT TYPE="TEXT" class="input_text" NAME="cCurrency" VALUE="<?php p(htmlspecialchars($publicationObj->getCurrency())); ?>" SIZE="10" MAXLENGTH="10">  
      135     </TD>  
      136 </TR>  
      137 <tr>  
      138     <td colspan="2" align="left"><?php  putGS("Time unit cost per one section"); ?>:</td>  
      139 </tr>  
      140 <TR>  
      141     <TD ALIGN="RIGHT">- <?php putGS('one language'); ?>:</TD>  
    142 142     <TD>  
    143 143     <INPUT TYPE="TEXT" class="input_text" NAME="cUnitCost" VALUE="<?php  p($publicationObj->getUnitCost()); ?>" SIZE="10" MAXLENGTH="10">  
    145 145 </TR>  
    146 146 <TR>  
    147       <TD ALIGN="RIGHT" ><?php  putGS("Currency"); ?>:</TD>  
      147     <TD ALIGN="RIGHT" >- <?php putGS('all languages'); ?>:</TD>  
    147 147     <TD>  
    148       <INPUT TYPE="TEXT" class="input_text" NAME="cCurrency" VALUE="<?php p(htmlspecialchars($publicationObj->getCurrency())); ?>" SIZE="10" MAXLENGTH="10">  
      148     <INPUT TYPE="TEXT" class="input_text" NAME="cUnitCostAllLang" VALUE="<?php  p($publicationObj->getUnitCostAllLang()); ?>" SIZE="10" MAXLENGTH="10">  
    148 148     </TD>  
    149 149 </TR>  
    150 150 <TR>  
    151       <TD ALIGN="RIGHT" ><?php  putGS("Paid Period"); ?>:</TD>  
      151     <TD ALIGN="RIGHT" ><?php  putGS("Default time period"); ?>:</TD>  
    151 151     <TD>  
    152       <INPUT TYPE="TEXT" class="input_text" NAME="cPaid" VALUE="<?php p($publicationObj->getPaidTime()); ?>" SIZE="10" MAXLENGTH="10"> <?php  p($pubTimeUnit->getName()); ?>  
      152     <INPUT TYPE="TEXT" class="input_text" NAME="cPaid" VALUE="<?php p($publicationObj->getPaidTime()); ?>" SIZE="10" MAXLENGTH="10"> <?php putGS('time units'); ?>  
    152 152     </TD>  
    153 153 </TR>  
      154 <tr>  
      155     <td colspan="2" align="left"><b><?php putGS('Trial subscriptions'); ?></b></td>  
      156 </tr>  
    154 157 <TR>  
    155       <TD ALIGN="RIGHT" ><?php  putGS("Trial Period"); ?>:</TD>  
      158     <TD ALIGN="RIGHT" ><?php  putGS("Default time period"); ?>:</TD>  
    155 158     <TD>  
    156       <INPUT TYPE="TEXT" class="input_text" NAME="cTrial" VALUE="<?php p($publicationObj->getTrialTime()); ?>" SIZE="10" MAXLENGTH="10"> <?php  p($pubTimeUnit->getName()); ?>  
      159     <INPUT TYPE="TEXT" class="input_text" NAME="cTrial" VALUE="<?php p($publicationObj->getTrialTime()); ?>" SIZE="10" MAXLENGTH="10"> <?php putGS('time units'); ?>  
    156 159     </TD>  
    157 160 </TR>  
  • trunk/campsite/implementation/management/priv/pub/add.php

    r4168 r4460  
    31 31 <FORM NAME="dialog" METHOD="POST" ACTION="do_add.php">  
    32 32 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
    33   <TR>  
    34       <TD COLSPAN="2">  
    35           <B><?php  putGS("Add new publication"); ?></B>  
    36           <HR NOSHADE SIZE="1" COLOR="BLACK">  
    37       </TD>  
    38   </TR>  
      33 <tr><td colspan=2><font size="+1"><b><?php putGS("General attributes"); ?></b></font></td></tr>  
    39 34 <TR>  
    40 35     <TD ALIGN="RIGHT" ><?php  putGS("Name"); ?>:</TD>  
     
    53 48     <TD>  
    54 49     <SELECT NAME="cLanguage" class="input_select">  
    55       <?php   
      50     <?php  
    55 50     foreach ($languages as $language) {  
    56 51         camp_html_select_option($language->getLanguageId(), $defaultLanguage->getLanguageId(), $language->getNativeName());  
     
    78 73  
    79 74 <tr><td colspan=2><HR NOSHADE SIZE="1" COLOR="BLACK"></td></tr>  
    80   <tr><td colspan=2><b><?php putGS("Subscriptions defaults"); ?></b></td></tr>  
    81   <TR>  
    82       <TD ALIGN="RIGHT" ><?php  putGS("Pay Period"); ?>:</TD>  
    83       <TD>  
    84       <INPUT TYPE="TEXT" class="input_text" NAME="cPayTime" VALUE="" SIZE="5" MAXLENGTH="5">  
    85       </TD>  
    86   </TR>  
      75 <tr><td colspan=2><font size="+1"><b><?php putGS("Subscriptions defaults"); ?></b></font></td></tr>  
    87 76 <TR>  
    88 77     <TD ALIGN="RIGHT" ><?php  putGS("Time Unit"); ?>:</TD>  
    89 78     <TD>  
    90 79     <SELECT NAME="cTimeUnit" class="input_select">  
    91       <?php   
      80     <?php  
    91 80     foreach ($timeUnits as $timeUnit) {  
    92           camp_html_select_option($timeUnit->getUnit(), 0, $timeUnit->getName());       
      81         camp_html_select_option($timeUnit->getUnit(), 0, $timeUnit->getName());  
    92 81     }  
    93       ?>       
      82     ?>  
    93 82     </SELECT>  
    94 83     </TD>  
    95 84 </TR>  
      85 <tr>  
      86     <td colspan="2" align="left"><b><?php putGS('Paid subscriptions'); ?></b></td>  
      87 </tr>  
    96 88 <TR>  
    97       <TD ALIGN="RIGHT" ><?php  putGS("Unit Cost"); ?>:</TD>  
      89     <TD ALIGN="RIGHT" ><?php  putGS("Currency"); ?>:</TD>  
      90     <TD>  
      91     <INPUT TYPE="TEXT" class="input_text" NAME="cCurrency" VALUE="" SIZE="10" MAXLENGTH="10">  
      92     </TD>  
      93 </TR>  
      94 <tr>  
      95     <td colspan="2" align="left"><?php  putGS("Time unit cost per one section"); ?>:</td>  
      96 </tr>  
      97 <TR>  
      98     <TD ALIGN="RIGHT" >- <?php putGS('one language'); ?>:</TD>  
    98 99     <TD>  
    99 100     <INPUT TYPE="TEXT" class="input_text" NAME="cUnitCost" VALUE="" SIZE="10" MAXLENGTH="10">  
    104 105 </TR>  
    105 106 <TR>  
    106       <TD ALIGN="RIGHT" ><?php  putGS("Currency"); ?>:</TD>  
      107     <TD ALIGN="RIGHT" >- <?php putGS('all languages'); ?>:</TD>  
    106 107     <TD>  
    107       <INPUT TYPE="TEXT" class="input_text" NAME="cCurrency" VALUE="" SIZE="10" MAXLENGTH="10">  
      108     <INPUT TYPE="TEXT" class="input_text" NAME="cUnitCostAllLang" VALUE="" SIZE="10" MAXLENGTH="10">  
    107 108     </TD>  
    108 109 </TR>  
    109 110 <TR>  
    110       <TD ALIGN="RIGHT" ><?php  putGS("Paid Period"); ?>:</TD>  
      111     <TD ALIGN="RIGHT" ><?php  putGS("Default time period"); ?>:</TD>  
    110 111     <TD>  
    111 112     <INPUT TYPE="TEXT" class="input_text" NAME="cPaid" VALUE="" SIZE="10" MAXLENGTH="10">  
    112 113     </TD>  
    113 114 </TR>  
      115 <tr>  
      116     <td colspan="2" align="left"><b><?php putGS('Trial subscriptions'); ?></b></td>  
      117 </tr>  
    114 118 <TR>  
    115       <TD ALIGN="RIGHT" ><?php  putGS("Trial Period"); ?>:</TD>  
      119     <TD ALIGN="RIGHT" ><?php  putGS("Default time period"); ?>:</TD>  
    115 119     <TD>  
    116 120     <INPUT TYPE="TEXT" class="input_text" NAME="cTrial" VALUE="" SIZE="10" MAXLENGTH="10">  
  • trunk/campsite/implementation/management/priv/users/subscriptions/do_add.php

    r4073 r4460  
    21 21  
    22 22 $f_user_id = Input::Get('f_user_id', 'int', 0);  
    23   $f_publication_id = Input::Get('f_publication_id');  
      23 $f_publication_id = Input::Get('f_publication_id', 'int', 0);  
      24 $f_language_set = Input::Get('f_language_set', 'string', 'all');  
      25 $f_language_id = Input::Get('f_language_id', 'array', 0);  
    24 26 $f_subscription_active = Input::Get('f_subscription_active', 'string', '', true);  
    25 27 $f_subscription_type = Input::Get('f_subscription_type');  
     
    28 30 $f_subscription_days = Input::Get('f_subscription_days');  
    29 31  
      32 if ($f_language_set == 'all') {  
      33     $f_language_id = array('0');  
      34 }  
      35  
    30 36 if ($f_subscription_active === "on") {  
    31 37     $f_subscription_active = "Y";  
     
    46 52 }  
    47 53  
      54 if ($f_publication_id <= 0) {  
      55     camp_html_display_error("Unable to create the subscription: please select a publication.", "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
      56     exit;  
      57 }  
      58  
    48 59 $subscription =& new Subscription();  
    49 60 $created = $subscription->create(array(  
    50       'IdUser' => $f_user_id,  
    51       'IdPublication' => $f_publication_id,  
      61     'IdUser' => $f_user_id,  
      62     'IdPublication' => $f_publication_id,  
    52 63     'Active' => $f_subscription_active,  
    53 64     'Type' => $f_subscription_type));  
    54 65  
    55 66 if (!$created) {  
    56       $errorMsgs[] = getGS('The subscription could not be added.').' '.getGS("Please check if there isn't another subscription to the same publication.");   
      67     $errorMsgs[] = getGS('The subscription could not be added.').' '.getGS("Please check if there isn't another subscription to the same publication.");  
    56 67 }  
    57 68  
     
    61 72               'Days' => $f_subscription_days,  
    62 73               'PaidDays' => $paidDays);  
    63       echo "<pre>";print_r($columns);echo "</pre>";  
    64       $created = SubscriptionSection::AddSubscriberToPublication(  
    65           $subscription->getSubscriptionId(),  
    66           $f_publication_id,  
    67           $columns);  
    68       if (!$created) {  
    69           $errorMsgs[] = getGS('The sections could not be added successfully. Some of them were already added !');  
      74     foreach ($f_language_id as $language_id) {  
      75         $created = SubscriptionSection::AddSubscriberToPublication(  
      76             $subscription->getSubscriptionId(),  
      77             $f_publication_id,  
      78             $language_id,  
      79             $columns);  
      80         if (!$created) {  
      81             $errorMsgs[] = getGS('The sections could not be added successfully. Some of them were already added !');  
      82             break;  
      83         }  
    70 84     }  
    71       else {  
    72           header("Location: /$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
    73           exit;  
    74       }  
    75   }  
      85 }  
      86 if (sizeof($errorMsgs) == 0) {  
      87     header("Location: /$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
      88     exit;  
      89 }  
    76 90  
    77 91 $crumbs = array();  
    78 92 $crumbs[] = array(getGS("Configure"), "");  
    79 93 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    80   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",   
      94 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    80 94             "/$ADMIN/users/edit.php?User=$User&uType=Subscribers");  
    81 95 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
     
    96 110     <TD COLSPAN="2">  
    97 111     <BLOCKQUOTE>  
    98       <?php   
      112     <?php  
    98 112     foreach ($errorMsgs as $errorMsg) { ?>  
    99 113         <LI><?php p($errorMsg); ?></LI>  
    109 123     <TD COLSPAN="2">  
    110 124     <DIV ALIGN="CENTER">  
    111       <INPUT TYPE="button" class="button" NAME="OK" VALUE="<?php  putGS('OK'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/users/subscriptions/add.php?f_user_id=<?php p($f_user_id); ?>'">  
      125     <INPUT TYPE="button" class="button" NAME="OK" VALUE="<?php  putGS('OK'); ?>" ONCLICK="location.href='/<?php p($ADMIN); ?>/users/subscriptions/?f_user_id=<?php p($f_user_id); ?>'">  
    111 125     </DIV>  
    112 126     </TD>  
  • trunk/campsite/implementation/management/priv/users/subscriptions/sections/do_add.php

    r4085 r4460  
    25 25 $f_publication_id = Input::Get('f_publication_id', 'int', 0);  
    26 26 $f_subscription_id = Input::Get('f_subscription_id', 'int', 0);  
    27   $f_section_number = Input::Get('f_section_number', 'int', 0);  
      27 $f_section_number = Input::Get('f_section_number', 'array');  
      28 $f_section_id = Input::Get('f_section_id', 'array');  
      29 $f_language_set = Input::Get('f_language_set', 'string', 'all');  
    28 30 $f_subscription_start_date = Input::Get('f_subscription_start_date');  
    29 31 $f_subscription_days = Input::Get('f_subscription_days');  
     
    32 34 $publicationObj =& new Publication($f_publication_id);  
    33 35 $languageObj =& new Language($publicationObj->getDefaultLanguageId());  
      36 $languages = $publicationObj->getLanguages();  
    34 37 $manageUser =& new User($f_user_id);  
    35 38 $errorMsgs = array();  
    36 39  
    37   if ($f_section_number != 0) {  
    38       $subscriptionSection =& new SubscriptionSection($f_subscription_id, $f_section_number);  
    39       $columns = array('StartDate' => $f_subscription_start_date,  
    40                        'Days' => $f_subscription_days,  
    41                        'PaidDays' => $f_subscription_days);  
    42       if (!$subscriptionSection->exists()) {  
    43           $success = $subscriptionSection->create($columns);  
    44       }  
    45       if (!$success) {  
    46           $errorMsgs[] = getGS('The section could not be added.').' '.getGS("Please check if there isn't another subscription with the same section.");         
      40 $new_sections = array();  
      41 if ($f_language_set == 'all') {  
      42     foreach ($f_section_number as $section_number) {  
      43         $new_sections[$section_number][] = 0;  
    47 44     }  
    48 45 } else {  
    49       $sections = Section::GetUniqueSections($f_publication_id);  
    50       $columns = array('StartDate' => $f_subscription_start_date,  
    51                        'Days' => $f_subscription_days,  
    52                        'PaidDays' => $f_subscription_days);  
    53       foreach ($sections as $section) {  
    54           $subscriptionSection =& new SubscriptionSection($f_subscription_id, $section['id']);  
      46     foreach ($f_section_id as $section_id) {  
      47         $id = explode('_', $section_id);  
      48         $new_sections[$id[0]][] = $id[1];  
      49     }  
      50 }  
      51  
      52 $columns = array('StartDate' => $f_subscription_start_date,  
      53                  'Days' => $f_subscription_days,  
      54                  'PaidDays' => $f_subscription_days);  
      55 foreach ($new_sections as $section_number=>$section_languages) {  
      56     foreach ($section_languages as $section_language) {  
      57         echo "<p>try $section_number:$section_language</p>\n";  
      58         $subscriptionSection =& new SubscriptionSection($f_subscription_id, $section_number, $section_language);  
    55 59         if (!$subscriptionSection->exists()) {  
      60             echo "<p>create $section_number:$section_language</p>\n";  
    56 61             $success &= $subscriptionSection->create($columns);  
    57 62         }  
    58 63     }  
    59       if (!$success) {  
    60           $errorMsgs[] = getGS('The sections could not be added successfully. Some of them were already added !');  
    61       }  
    62 64 }  
    63 65 if ($success) {  
    64 66     header("Location: /$ADMIN/users/subscriptions/sections/?f_user_id=$f_user_id&f_subscription_id=$f_subscription_id&f_publication_id=$f_publication_id");  
    65 67     exit;  
      68 } else {  
      69     $errorMsgs[] = getGS('The sections could not be added successfully. Some of them were already added !');  
    66 70 }  
    67 71  
     
    69 73 $crumbs[] = array(getGS("Configure"), "");  
    70 74 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    71   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",   
      75 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    71 75             "/$ADMIN/users/edit.php?User=$User&uType=Subscribers");  
    72 76 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
    88 92     <TD COLSPAN="2">  
    89 93     <BLOCKQUOTE>  
    90       <?php   
      94     <?php  
    90 94     foreach ($errorMsgs as $errorMsg) { ?>  
    91 95         <LI><?php p($errorMsg); ?></LI>  
  • trunk/campsite/implementation/management/priv/users/subscriptions/sections/change.php

    r4202 r4460  
    23 23 $f_user_id = Input::Get('f_user_id', 'int', 0);  
    24 24 $f_publication_id = Input::Get('f_publication_id', 'int', 0);  
      25 $f_language_id = Input::Get('f_language_id', 'int', null);  
    25 26 $f_subscription_id = Input::Get('f_subscription_id', 'int', 0);  
    26 27 $f_section_number = Input::Get('f_section_number', 'int', null);  
     
    35 36 }  
    36 37  
    37   //$subscriptionSection =& new SubscriptionSection($f_subscription_id, $f_section_number);  
    38   $subscriptionSections = SubscriptionSection::GetSubscriptionSections($f_subscription_id, $f_section_number);  
      38 $subscriptionSections = SubscriptionSection::GetSubscriptionSections($f_subscription_id,  
      39                             $f_section_number, $f_language_id);  
    39 40 $subscriptionSection = array_pop($subscriptionSections);  
      41 if ($f_section_number > 0) {  
      42     if ($f_language_id > 0) {  
      43         $subscriptionSectionLanguage =& new Language($f_language_id);  
      44         $languageName = $subscriptionSectionLanguage->getName();  
      45     } else {  
      46         $languageName = '-- ' . getGS('All languages') . ' --';  
      47     }  
      48 } else {  
      49     $languageName = getGS('N/A');  
      50 }  
    40 51  
    41 52 $crumbs = array();  
    42 53 $crumbs[] = array(getGS("Configure"), "");  
    43 54 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    44   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",   
      55 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    44 55             "/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");  
    45 56 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
     
    72 83         p(htmlspecialchars($subscriptionSection->getProperty('Name')));  
    73 84     } else {  
    74           putGS("-- ALL SECTIONS --");   
      85         putGS("-- ALL SECTIONS --");  
    74 85     }  
    75 86     ?>  
     
    78 89 </TR>  
    79 90 <TR>  
      91     <TD ALIGN="RIGHT" ><?php putGS("Language"); ?>:</TD>  
      92     <TD><?php p($languageName); ?></TD>  
      93 </TR>  
      94 <TR>  
    80 95     <TD ALIGN="RIGHT" ><?php  putGS("Start"); ?>:</TD>  
    81 96     <TD>  
     
    93 108     <TD ALIGN="RIGHT" ><?php  putGS("Paid Days"); ?>:</TD>  
    94 109     <TD>  
    95       <INPUT TYPE="TEXT" class="input_text" NAME="f_subscription_paid_days" SIZE="5" VALUE="<?php  p($subscriptionSection->getPaidDays()); ?>"  MAXLENGTH="5" alt="number|0|1|1000000000" emsg="<?php putGS("You must input a number greater than 0 into the $1 field.", "Paid Days"); ?>">  
      110     <INPUT TYPE="TEXT" class="input_text" NAME="f_subscription_paid_days" SIZE="5" VALUE="<?php  p($subscriptionSection->getPaidDays()); ?>" MAXLENGTH="5" alt="number|0|0|1000000000" emsg="<?php putGS("You must input a number greater or equal to 0 into the $1 field.", "Paid Days"); ?>">  
    95 110     </TD>  
    96 111 </TR>  
    104 119     <INPUT TYPE="HIDDEN" NAME="f_section_number" VALUE="<?php p($f_section_number); ?>">  
    105 120     <INPUT TYPE="HIDDEN" NAME="f_publication_id" VALUE="<?php p($f_publication_id); ?>">  
      121     <INPUT TYPE="HIDDEN" NAME="f_language_id" VALUE="<?php p($f_language_id); ?>">  
    106 122     <INPUT TYPE="submit" class="button" NAME="Save" VALUE="<?php  putGS('Save'); ?>">  
    107 123     <!--<INPUT TYPE="button" class="button" NAME="Cancel" VALUE="<?php  putGS('Cancel'); ?>" ONCLICK="location.href='/admin/users/subscriptions/sections/?Pub=<?php  p($Pub); ?>&User=<?php  p($User); ?>&Subs=<?php  p($Subs); ?>'">-->  
  • trunk/campsite/implementation/management/priv/users/subscriptions/sections/do_del.php

    r4085 r4460  
    23 23 $f_user_id = Input::Get('f_user_id', 'int', 0);  
    24 24 $f_publication_id = Input::Get('f_publication_id', 'int', 0);  
      25 $f_language_id = Input::Get('f_language_id', 'int', 0);  
    25 26 $f_subscription_id = Input::Get('f_subscription_id', 'int', 0);  
    26 27 $f_section_number = Input::Get('f_section_number', 'int', 0);  
    30 31 $manageUser =& new User($f_user_id);  
    31 32  
    32   $subscriptionSection =& new SubscriptionSection($f_subscription_id, $f_section_number);  
      33 $subscriptionSection =& new SubscriptionSection($f_subscription_id, $f_section_number, $f_language_id);  
    32 33 $subscriptionSection->delete();  
    33 34 header("Location: /$ADMIN/users/subscriptions/sections/?f_user_id=$f_user_id&f_subscription_id=$f_subscription_id&f_publication_id=$f_publication_id");  
  • trunk/campsite/implementation/management/priv/users/subscriptions/sections/do_change.php

    r4085 r4460  
    23 23 $f_user_id = Input::Get('f_user_id', 'int', 0);  
    24 24 $f_publication_id = Input::Get('f_publication_id', 'int', 0);  
      25 $f_language_id = Input::Get('f_language_id', 'int', null);  
    25 26 $f_subscription_id = Input::Get('f_subscription_id', 'int', 0);  
    26 27 $f_section_number = Input::Get('f_section_number', 'int', null);  
     
    38 39 }  
    39 40  
    40   //$subscriptionSection =& new SubscriptionSection($f_subscription_id, $f_section_number);  
    41   $subscriptionSections = SubscriptionSection::GetSubscriptionSections($f_subscription_id, $f_section_number);  
    42   //print_r($subscriptionSections);  
    43   //exit;  
    44   //$subscriptionSection = array_pop($subscriptionSections);  
      41 $subscriptionSections = SubscriptionSection::GetSubscriptionSections($f_subscription_id, $f_section_number, $f_language_id);  
    45 42  
    46 43 if (!$isPaid) {  
    59 56 $crumbs[] = array(getGS("Configure"), "");  
    60 57 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    61   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",   
      58 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    61 58             "/$ADMIN/users/edit.php?User=$User&uType=Subscribers");  
    62 59 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
  • trunk/campsite/implementation/management/priv/users/subscriptions/sections/index.php

    r4203 r4460  
    29 29 $crumbs[] = array(getGS("Configure"), "");  
    30 30 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    31   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    32               "/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");  
      31 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
      32 "/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");  
    33 33 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
    34 34 $crumbs[] = array(getGS("Subscribed sections").": ".$publicationObj->getName(), "");  
    35 35 echo camp_html_breadcrumbs($crumbs);  
    36 36  
      37 $subscription_num_sections = SubscriptionSection::GetNumSections($f_subscription_id);  
      38 $publication_num_sections = Section::GetNumUniqueSections($f_publication_id);  
      39  
      40 $subscription_num_sections_nolang = SubscriptionSection::GetNumSections($f_subscription_id, null, 0);  
      41 $publication_num_sections_nolang = Section::GetNumUniqueSections($f_publication_id, false);  
      42  
    37 43 ?>  
    38 44 <P>  
     
    41 47     <td valign=top>  
    42 48         <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1">  
      49 <?php  
      50 if ($subscription_num_sections < $publication_num_sections  
      51     || $subscription_num_sections_nolang < $publication_num_sections_nolang) {  
      52 ?>  
    43 53         <TR>  
    44 54             <TD><A HREF="add.php?f_subscription_id=<?php p($f_subscription_id); ?>&f_publication_id=<?php p($f_publication_id); ?>&f_user_id=<?php  p($f_user_id); ?>" ><IMG SRC="<?php echo $Campsite['ADMIN_IMAGE_BASE_URL']; ?>/add.png" BORDER="0"></A></TD>  
    45 55             <TD><A HREF="add.php?f_subscription_id=<?php p($f_subscription_id); ?>&f_publication_id=<?php p($f_publication_id); ?>&f_user_id=<?php  p($f_user_id); ?>" ><B><?php  putGS("Add new section to subscription"); ?></B></A></TD>  
    46 56         </TR>  
      57 <?php  
      58 } // if ($subscription_num_sections < $publication_num_sections)  
      59 ?>  
    47 60         </TABLE>  
    48 61     </td>  
     
    60 73 <p>  
    61 74  
    62   <?PHP  
      75 <?php  
    62 75 $isPaid = 0;  
    63   $sType = $sections[0]->getProperty('Type');  
    64   if ($sType == 'P') {  
    65       $isPaid = 1;  
      76 if (isset($sections[0])) {  
      77     $sType = $sections[0]->getProperty('Type');  
      78     if ($sType == 'P') {  
      79         $isPaid = 1;  
      80     }  
    66 81 }  
    67 82 ?>  
     
    70 85 <TR class="table_list_header">  
    71 86     <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Section"); ?></B></TD>  
      87     <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Language"); ?></B></TD>  
    72 88     <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Start Date<BR><SMALL>(yyyy-mm-dd)</SMALL>"); ?></B></TD>  
    73 89     <TD ALIGN="LEFT" VALIGN="TOP"><B><?php  putGS("Days"); ?></B></TD>  
     
    78 94 </TR>  
    79 95  
    80   <?php   
      96 <?php  
    80 96 $color= 0;  
    81   foreach ($sections as $section) { ?>     
      97 foreach ($sections as $section) { ?>  
    81 97 <TR <?php  if ($color) { $color=0; ?>class="list_row_even"<?php  } else { $color=1; ?>class="list_row_odd"<?php  } ?>>  
    82 98     <TD >  
    83           <A HREF="/<?php p($ADMIN); ?>/users/subscriptions/sections/change.php?f_user_id=<?php p($f_user_id); ?>&f_publication_id=<?php p($f_publication_id); ?>&f_subscription_id=<?php p($f_subscription_id); ?>&f_section_number=<?php p($section->getSectionNumber()); ?>"><?php p(htmlspecialchars($section->getProperty('Name'))); ?></A>  
      99         <A HREF="/<?php p($ADMIN); ?>/users/subscriptions/sections/change.php?f_user_id=<?php p($f_user_id); ?>&f_publication_id=<?php p($f_publication_id); ?>&f_language_id=<?php p($section->getProperty('IdLanguage')); ?>&f_subscription_id=<?php p($f_subscription_id); ?>&f_section_number=<?php p($section->getSectionNumber()); ?>"><?php p(htmlspecialchars($section->getProperty('Name'))); ?></A>  
      100     </TD>  
      101  
      102     <TD>  
      103 <?php  
      104 $language_name = $section->getProperty('LangName');  
      105 if ($language_name != '') {  
      106     p($language_name);  
      107 } else {  
      108     p('-- '.getGS('All languages').' --');  
      109 }  
      110 ?>  
    84 111     </TD>  
    85        
      112  
    85 112     <TD>  
    86 113         <?php  p(htmlspecialchars($section->getStartDate())); ?>  
    87 114     </TD>  
    88        
      115  
    88 115     <TD>  
    89 116         <?php  p($section->getDays()); ?>  
    90 117     </TD>  
    91        
      118  
    91 118     <?php  if ($isPaid) { ?>  
    92 119     <TD>  
    99 126     </TD>  
    100 127     <?php  } ?>  
    101        
      128  
    101 128     <TD ALIGN="CENTER">  
    102           <A HREF="/<?php p($ADMIN); ?>/users/subscriptions/sections/do_del.php?f_user_id=<?php p($f_user_id); ?>&f_publication_id=<?php p($f_publication_id); ?>&f_subscription_id=<?php p($f_subscription_id); ?>&f_section_number=<?php p($section->getSectionNumber()); ?>"><IMG SRC="<?php echo $Campsite['ADMIN_IMAGE_BASE_URL']; ?>/delete.png" BORDER="0" ALT="<?php  putGS('Delete subscription to section $1?', htmlspecialchars($section->getProperty('Name'))); ?>" TITLE="<?php  putGS('Delete subscription to section $1?', htmlspecialchars($section->getProperty('Name'))); ?>" onclick="return confirm('<?php putGS('Are you sure you want to delete the subscription to the section $1?', htmlspecialchars($section->getProperty('Name'))); ?>');"></A>  
      129         <A HREF="/<?php p($ADMIN); ?>/users/subscriptions/sections/do_del.php?f_user_id=<?php p($f_user_id); ?>&f_publication_id=<?php p($f_publication_id); ?>&f_language_id=<?php p($section->getProperty('IdLanguage')); ?>&f_subscription_id=<?php p($f_subscription_id); ?>&f_section_number=<?php p($section->getSectionNumber()); ?>"><IMG SRC="<?php echo $Campsite['ADMIN_IMAGE_BASE_URL']; ?>/delete.png" BORDER="0" ALT="<?php  putGS('Delete subscription to section $1?', htmlspecialchars($section->getProperty('Name'))); ?>" TITLE="<?php  putGS('Delete subscription to section $1?', htmlspecialchars($section->getProperty('Name'))); ?>" onclick="return confirm('<?php putGS('Are you sure you want to delete the subscription to the section $1?', htmlspecialchars($section->getProperty('Name'))); ?>');"></A>  
    102 129     </TD>  
    103 130 </TR>  
    104   <?php   
      131 <?php  
    104 131 }  
    105   ?>   
      132 ?>  
    105 132  
    106 133 <?php camp_html_copyright_notice(); ?>  
  • trunk/campsite/implementation/management/priv/users/subscriptions/sections/add.php

    r4201 r4460  
    7 7 require_once($_SERVER['DOCUMENT_ROOT']. '/classes/Language.php');  
    8 8 require_once($_SERVER['DOCUMENT_ROOT']. '/classes/Publication.php');  
      9 require_once($_SERVER['DOCUMENT_ROOT']. '/classes/SubscriptionSection.php');  
    9 10 require_once($_SERVER['DOCUMENT_ROOT']."/$ADMIN_DIR/camp_html.php");  
    10 11 require_once($_SERVER['DOCUMENT_ROOT']."/db_connect.php");  
     
    31 32  
    32 33 $sections = Section::GetUniqueSections($f_publication_id);  
      34 $sectionsByLanguage = Section::GetUniqueSections($f_publication_id, true);  
    33 35  
    34 36 $crumbs = array();  
    35 37 $crumbs[] = array(getGS("Configure"), "");  
    36 38 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    37   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",   
      39 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    37 39             "/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");  
    38 40 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
     
    43 45  
    44 46 ?>  
    45        
      47 <script>  
      48 function ToggleRowVisibility(id) {  
      49     if (document.getElementById(id).style.display == "none") {  
      50         if (document.all) {  
      51             document.getElementById(id).style.display = "block";  
      52         }  
      53         else {  
      54             document.getElementById(id).style.display = "";  
      55         }  
      56     }  
      57     else {  
      58         document.getElementById(id).style.display = "none";  
      59     }  
      60 }  
      61 function ToggleBoolValue(element_id) {  
      62     if (document.getElementById(element_id).value == "false") {  
      63         document.getElementById(element_id).value = "true";  
      64     }  
      65     else {  
      66        document.getElementById(element_id).value = "false";  
      67     }  
      68 }  
      69 </script>  
      70  
    46 71 <script type="text/javascript" src="<?php echo $Campsite['WEBSITE_URL']; ?>/javascript/fValidate/fValidate.config.js"></script>  
    47 72 <script type="text/javascript" src="<?php echo $Campsite['WEBSITE_URL']; ?>/javascript/fValidate/fValidate.core.js"></script>  
     
    53 78 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
    54 79 <TR>  
    55       <TD COLSPAN="2">  
    56           <B><?php  putGS("Add new subscription"); ?></B>  
    57           <HR NOSHADE SIZE="1" COLOR="BLACK">  
      80     <TD ALIGN="RIGHT"><?php  putGS("Languages"); ?>:</TD>  
      81     <TD>  
      82         <select name="f_language_set" class="input_select" onchange="ToggleRowVisibility('select_section_lang'); ToggleRowVisibility('select_section_all');">  
      83 <?php  
      84         $language_sets = array('select'=>getGS('Individual languages'), 'all'=>getGS('Regardless of the language'));  
      85         foreach ($language_sets as $language_set_id=>$language_set_description) {  
      86             camp_html_select_option($language_set_id, '', $language_set_description);  
      87         }  
      88 ?>  
      89         </select>  
      90 </tr>  
      91 <TR id="select_section_all" style="display: none;">  
      92     <TD ALIGN="RIGHT" valign="top"><?php  putGS("Sections"); ?>:</TD>  
      93     <TD>  
      94         <SELECT NAME="f_section_number[]" class="input_select" multiple size="3">  
      95         <?php  
      96         foreach ($sections as $section) {  
      97             if (SubscriptionSection::GetNumSections($f_subscription_id, $section['id'], 0) > 0) {  
      98                 continue;  
      99             }  
      100             $id = $section['id'];  
      101             $display = $section['id'] . ' - ' . $section['name'];  
      102             camp_html_select_option($id, '', $display);  
      103         }  
      104         ?>  
      105         </SELECT>  
    58 106     </TD>  
    59 107 </TR>  
    60    
    61   <TR>  
    62       <TD ALIGN="RIGHT" ><?php  putGS("Section"); ?>:</TD>  
      108 <TR id="select_section_lang" valign="top">  
      109     <TD ALIGN="RIGHT" ><?php  putGS("Sections"); ?>:</TD>  
    63 110     <TD>  
    64           <SELECT NAME="f_section_number" class="input_select">  
    65           <OPTION VALUE="0">All sections</OPTION>  
    66           <?php   
    67           foreach ($sections as $section) {  
    68               camp_html_select_option($section['id'], '', $section['name']." (".$section['id'].")");  
      111         <SELECT NAME="f_section_id[]" class="input_select" multiple size="3">  
      112         <?php  
      113         foreach ($sectionsByLanguage as $section) {  
      114             if (SubscriptionSection::GetNumSections($f_subscription_id, $section['id'], $section['IdLanguage']) > 0) {  
      115                 continue;  
      116             }  
      117             $id = $section['id'] . '_' . $section['IdLanguage'];  
      118             $display = $section['id'] . ' - ' . $section['name']  
      119                 . ' (' . $section['LangName'] . ')';  
      120             camp_html_select_option($id, '', $display);  
    69 121         }  
    70 122         ?>  
    72 124     </TD>  
    73 125 </TR>  
    74    
    75 126 <TR>  
    76 127     <TD ALIGN="RIGHT" ><?php  putGS("Start"); ?>:</TD>  
  • trunk/campsite/implementation/management/priv/users/subscriptions/index.php

    r4077 r4460  
    22 22 $manageUser =& new User($f_user_id);  
    23 23  
      24 $publications = Publication::GetPublications();  
    24 25 $numSubscriptions = Subscription::GetNumSubscriptions(null, $f_user_id);  
    25   $subscriptions = Subscription::GetSubscriptions(null, $f_user_id,  
    26       array("ORDER BY" => array("Id" => "DESC"),  
      26 $subscriptions = Subscription::GetSubscriptions(null, $f_user_id,  
      27     array("ORDER BY" => array("Id" => "DESC"),  
    27 28           "LIMIT" => array("START" => $f_subscription_offset, "MAX_ROWS" => $ItemsPerPage)));  
    28 29  
     
    30 31 $crumbs[] = array(getGS("Configure"), "");  
    31 32 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    32   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",   
      33 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    32 33             "/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");  
    33 34 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
    34 35 echo camp_html_breadcrumbs($crumbs);  
    35 36  
      37 if (sizeof($publications) > $numSubscriptions) {  
    36 38 ?>  
    37        
    38 39 <P>  
    39 40 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons">  
     
    44 45 </TR>  
    45 46 </TABLE>  
      47 <?php  
      48 } // if (sizeof($publications) > $numSubscriptions)  
      49 ?>  
    46 50 <P>  
    47 51 <TABLE BORDER="0" CELLSPACING="1" CELLPADDING="3" class="table_list">  
     
    54 58 </TR>  
    55 59  
    56   <?php   
      60 <?php  
    56 60 $color=0;  
    57 61 foreach ($subscriptions as $subscription) { ?>  
     
    62 66         <A HREF="/<?php p($ADMIN); ?>/users/subscriptions/sections/?f_subscription_id=<?php p($subscription->getSubscriptionId()); ?>&f_publication_id=<?php p($subscription->getPublicationId()); ?>&f_user_id=<?php p($f_user_id); ?>"><?php p(htmlspecialchars($publication->getName())); ?></A>   
    63 67     </TD>  
    64        
      68  
    64 68     <TD >  
    65 69         <A HREF="/<?php p($ADMIN); ?>/users/subscriptions/topay.php?f_user_id=<?php p($f_user_id); ?>&f_subscription_id=<?php p($subscription->getSubscriptionId()); ?>"><?php  p(htmlspecialchars($subscription->getToPay()).' '.htmlspecialchars($subscription->getCurrency())); ?>  
    66 70     </TD>  
    67        
      71  
    67 71     <TD >  
    68           <?php   
      72         <?php  
    68 72         $sType = $subscription->getType();  
    69 73         if ($sType == 'T') {  
     
    77 81         ?>  
    78 82     </TD>  
    79        
      83  
    79 83     <TD ALIGN="CENTER">  
    80 84     <?php if ($subscription->isActive()) { ?>  
     
    89 93     </TD>  
    90 94 </TR>  
    91   <?php   
      95 <?php  
    91 95 }  
    92 96 ?>  
    97 101         <B><A HREF="index.php?f_user_id=<?php p($f_user_id); ?>&f_subscription_offset=<?php p(max(0, ($f_subscription_offset - $ItemsPerPage))); ?>"><< <?php  putGS('Previous'); ?></A></B>  
    98 102     <?php  } ?>  
    99        
      103  
    99 103     <?php  if ($numSubscriptions > ($f_subscription_offset + $ItemsPerPage)) { ?>  
    100 104         | <B><A HREF="index.php?f_user_id=<?php p($f_user_id); ?>&f_subscription_offset=<?php  p($f_subscription_offset + $ItemsPerPage); ?>"><?php  putGS('Next'); ?> >></A></B>  
  • trunk/campsite/implementation/management/priv/users/subscriptions/add.php

    r4199 r4460  
    21 21 $f_user_id = Input::Get('f_user_id', 'int', 0);  
    22 22 $f_subscription_id = Input::Get('f_subscription_id', 'int', 0);  
    23   $f_publication_id = Input::Get('f_publication_id');  
      23 $f_publication_id = Input::Get('f_publication_id', 'int', 0);  
      24 $f_add_sections_now = Input::Get('f_add_sections_now', 'string', 'Y');  
      25 $f_language_set = Input::Get('f_language_set', 'string', 'select');  
      26 $f_subscription_start_date = Input::Get('f_subscription_start_date', 'string', date("Y-m-d"));  
      27 $f_subscription_type = Input::Get('f_subscription_type', 'string', 'PN');  
      28 $f_subscription_days = Input::Get('f_subscription_days', 'int', 0);  
    24 29  
    25 30 $manageUser =& new User($f_user_id);  
    26   $subscription =& new Subscription($f_subscription_id);  
    27 31 $publications = Publication::GetPublications();  
      32 $subscriptions = Subscription::GetSubscriptions(null, $f_user_id);  
      33 if (sizeof($subscriptions) > 0) {  
      34     $subscriptions_ids = array();  
      35     foreach ($subscriptions as $subscription) {  
      36         $subscriptions_ids[] = $subscription->getPublicationId();  
      37     }  
      38     $remaining_publications = array();  
      39     foreach ($publications as $publication) {  
      40         if (!in_array($publication->getPublicationId(), $subscriptions_ids)) {  
      41             $remaining_publications[] = $publication;  
      42         }  
      43     }  
      44     $publications = $remaining_publications;  
      45 }  
      46  
      47 if (sizeof($publications) <= 0) {  
      48     camp_html_display_error('Subscriptions exist for all available publications!', "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
      49     exit;  
      50 }  
      51  
      52 if ($f_publication_id > 0) {  
      53     $default_publication = new Publication($f_publication_id);  
      54 } elseif (sizeof($publications) > 0) {  
      55     $default_publication = $publications[0];  
      56 } else {  
      57     $default_publication = null;  
      58 }  
      59 if ($default_publication != null) {  
      60     $languages = $default_publication->getLanguages();  
      61 } else {  
      62     $languages = array();  
      63 }  
    28 64  
    29 65 $crumbs = array();  
    30 66 $crumbs[] = array(getGS("Configure"), "");  
    31 67 $crumbs[] = array(getGS("Subscribers"), "/$ADMIN/users/?uType=Subscribers");  
    32   $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",   
      68 $crumbs[] = array(getGS("Account") . " '".$manageUser->getUserName()."'",  
    32 68             "/$ADMIN/users/edit.php?User=$f_user_id&uType=Subscribers");  
    33 69 $crumbs[] = array(getGS("Subscriptions"), "/$ADMIN/users/subscriptions/?f_user_id=$f_user_id");  
     
    37 73  
    38 74 ?>  
      75 <script>  
      76 function ToggleRowVisibility(id) {  
      77     if (document.getElementById(id).style.display == "none") {  
      78         if (document.all) {  
      79             document.getElementById(id).style.display = "block";  
      80         }  
      81         else {  
      82             document.getElementById(id).style.display = "";  
      83         }  
      84     }  
      85     else {  
      86         document.getElementById(id).style.display = "none";  
      87     }  
      88 }  
      89 function ToggleBoolValue(element_id) {  
      90     if (document.getElementById(element_id).value == "false") {  
      91         document.getElementById(element_id).value = "true";  
      92     }  
      93     else {  
      94        document.getElementById(element_id).value = "false";  
      95     }  
      96 }  
      97 </script>  
    39 98 <HEAD>  
    40 99     <LINK rel="stylesheet" type="text/css" href="<?php echo $Campsite['WEBSITE_URL']; ?>/css/admin_stylesheet.css">  
     
    50 109 <TABLE BORDER="0" CELLSPACING="0" CELLPADDING="6" CLASS="table_input">  
    51 110 <TR>  
    52       <TD COLSPAN="2">  
    53           <B><?php  putGS("Add new subscription"); ?></B>  
    54           <HR NOSHADE SIZE="1" COLOR="BLACK">  
    55       </TD>  
    56   </TR>  
    57   <TR>  
    58 111     <TD ALIGN="RIGHT" ><?php  putGS("Publication"); ?>:</TD>  
    59 112     <TD>  
    60           <SELECT NAME="f_publication_id" class="input_select">  
    61           <?php  
      113         <SELECT NAME="f_publication_id" class="input_select" ONCHANGE="if (this.options[this.selectedIndex].value != <?php p($f_publication_id); ?>) { this.form.action = 'add.php'; this.form.submit(); }">  
      114         <?php  
    62 115         foreach ($publications as $publication) {  
    63               camp_html_select_option($publication->getPublicationId(), '', $publication->getName());  
      116             camp_html_select_option($publication->getPublicationId(), $f_publication_id, $publication->getName());  
    63 116         }  
    64 117         ?>  
     
    68 121 </TR>  
    69 122 <TR>  
      123     <TD ALIGN="RIGHT"><?php  putGS("Languages"); ?>:</TD>  
      124     <TD>  
      125         <select name="f_language_set" class="input_select" onchange="ToggleRowVisibility('select_languages');">  
      126 <?php  
      127         $language_sets = array('select'=>getGS('Individual languages'), 'all'=>getGS('Regardless of the language'));  
      128         foreach ($language_sets as $language_set_id=>$language_set_description) {  
      129             camp_html_select_option($language_set_id, $f_language_set, $language_set_description);  
      130         }  
      131 ?>  
      132         </select>  
      133 </tr>  
      134 <tr id="select_languages" <?php if ($f_language_set == 'all') { ?>style="display: none;"<?php } ?>>  
      135     <td></td>  
      136     <td>  
      137         <select name="f_language_id[]" multiple size="3" class="input_select">  
      138         <?php  
      139         foreach ($languages as $language) {  
      140             camp_html_select_option($language->getLanguageId(), '', $language->getName() . ' (' . $language->getNativeName() . ')');  
      141         }  
      142         ?>  
      143         </select>  
      144     </TD>  
      145 </TR>  
      146 <TR>  
    70 147     <TD ALIGN="RIGHT" ><?php  putGS("Sections"); ?>:</TD>  
    71 148     <TD>  
    72 149         <SELECT NAME="f_add_sections_now" class="input_select">  
    73           <OPTION VALUE="Y"><?php  putGS('Add sections now'); ?></OPTION>  
    74           <OPTION VALUE="N"><?php  putGS('Add sections later'); ?></OPTION>  
      150 <?php  
      151         $add_sections_times = array('Y'=>getGS('Add sections now'), 'N'=>getGS('Add sections later'));  
      152         foreach ($add_sections_times as $add_sections_times_id=>$add_sections_times_description) {  
      153             camp_html_select_option($add_sections_times_id, $f_add_sections_now, $add_sections_times_description);  
      154         }  
      155 ?>  
    75 156         </SELECT>  
    76 157     </TD>  
     
    79 160     <TD ALIGN="RIGHT" ><?php  putGS("Start"); ?>:</TD>  
    80 161     <TD>  
    81       <INPUT TYPE="TEXT" class="input_text" NAME="f_subscription_start_date" SIZE="10" VALUE="<?php  p(date("Y-m-d")); ?>" MAXLENGTH="10" alt="date|yyyy/mm/dd|-" emsg="<?php putGS("You must input a valid date."); ?>"><?php  putGS('(YYYY-MM-DD)'); ?>  
      162     <INPUT TYPE="TEXT" class="input_text" NAME="f_subscription_start_date" SIZE="10" VALUE="<?php echo $f_subscription_start_date; ?>" MAXLENGTH="10" alt="date|yyyy/mm/dd|-" emsg="<?php putGS("You must input a valid date."); ?>"><?php  putGS('(YYYY-MM-DD)'); ?>  
    81 162     </TD>  
    82 163 </TR>  
     
    86 167     <TD>  
    87 168     <SELECT NAME="f_subscription_type" class="input_select">  
    88       <OPTION VALUE="PN"><?php  putGS("Paid (confirm payment now)"); ?></OPTION>  
    89       <OPTION VALUE="PL"><?php  putGS("Paid (payment will be confirmed later)"); ?></OPTION>  
    90       <OPTION VALUE="T"><?php  putGS("Trial"); ?></OPTION>  
      169 <?php  
      170     $subscription_types = array('PN'=>getGS('Paid (confirm payment now)'),  
      171                                 'PL'=>getGS('Paid (payment will be confirmed later)'),  
      172                                 'T'=>getGS('Trial'));  
      173     foreach ($subscription_types as $subscription_type_id=>$subscription_type_description) {  
      174         camp_html_select_option($subscription_type_id, $f_subscription_type, $subscription_type_description);  
      175     }  
      176 ?>  
    91 177     </SELECT>  
    92 178     </TD>  
    95 181     <TD ALIGN="RIGHT" ><?php  putGS("Days"); ?>:</TD>  
    96 182     <TD>  
    97       <INPUT TYPE="TEXT" class="input_text" NAME="f_subscription_days" SIZE="5" MAXLENGTH="5" alt="number|0|1|1000000000" emsg="<?php putGS("You must input a number greater than 0 into the $1 field.", "Days"); ?>">  
      183     <INPUT TYPE="TEXT" class="input_text" NAME="f_subscription_days" VALUE="<?php if ($f_subscription_days > 0) echo $f_subscription_days; ?>" SIZE="5" MAXLENGTH="5" alt="number|0|1|1000000000" emsg="<?php putGS("You must input a number greater than 0 into the $1 field.", "Days"); ?>">  
    97 183     </TD>  
    98 184 </TR>  
  • trunk/campsite/implementation/management/priv/users/edit.php

    r4279 r4460  
    29 29 $crumbs[] = array(getGS("Users"), "");  
    30 30 $crumbs[] = array(getGS($uType), "/$ADMIN/users/?".get_user_urlparams());  
    31   if ($userId > 0) {   
      31 if ($userId > 0) {  
    31 31     $crumbs[] = array(getGS("Change user account information"), "");  
    32 32 } else {  
     
    39 39 }  
    40 40 $breadcrumbs = camp_html_breadcrumbs($crumbs);  
    41   echo $breadcrumbs;   
      41 echo $breadcrumbs;  
    41 41 ?>  
    42 42 <p>  
    85 85 ?>  
    86 86  
    87    
    88 87 <table border="0">  
    89 88 <tr>  
  • trunk/campsite/implementation/management/priv/users/index.php

    r4313 r4460  
    36 36  
    37 37 $crumbs = array();  
    38   $crumbs[] = array(getGS("Users"), "");  
    39   if ($uType == "Staff") {  
    40       $crumbs[] = array(getGS("Staff management"), "");  
    41   } else {  
    42       $crumbs[] = array(getGS("Subscriber management"), "");  
      38 $crumbs[] = array(getGS("Users"), "");  
      39 if ($uType == "Staff") {  
      40     $crumbs[] = array(getGS("Staff management"), "");  
      41 } else {  
      42     $crumbs[] = array(getGS("Subscriber management"), "");  
    43 43 }  
    44 44 $breadcrumbs = camp_html_breadcrumbs($crumbs);  
     
    93 93         <?php putGS("Subscription"); ?>   
    94 94         <select name="subscription_how" class="input_select" style="width: 100px;">  
    95           <?php  
    96           camp_html_select_option("expires", $userSearchParameters['subscription_how'], getGS("expires"));  
    97           camp_html_select_option("starts", $userSearchParameters['subscription_how'], getGS("starts"));  
      95         <?php  
      96         camp_html_select_option("expires", $userSearchParameters['subscription_how'], getGS("expires"));  
      97         camp_html_select_option("starts", $userSearchParameters['subscription_how'], getGS("starts"));  
    98 98         ?>  
    99 99         </select>  
     
    233 233         </td>  
    234 234         <td align="left" valign="middle"><b><?php putGS("E-Mail"); ?></b></td>  
    235            
      235  
    235 235         <?php if ($uType == "Subscribers" && $User->hasPermission("ManageSubscriptions")) { ?>  
    236 236         <td align="left" valign="middle"><b><?php putGS("Subscriptions"); ?></b></td>  
    237 237         <?php } ?>  
    238            
      238  
    238 238         <?php if ($uType == "Staff") { ?>  
    239 239         <td align="left" valign="middle">  
     
    243 243         </td>  
    244 244         <?php } ?>  
    245            
      245  
    245 245         <td align="left" valign="middle">  
    246 246             <table><tr>  
     
    254 254 <?php } ?>  
    255 255     </TR>  
    256   <?php   
      256 <?php  
    256 256 for($loop = 0; $loop < $last; $loop++) {  
    257 257     $row = $res->FetchRow();  
     
    285 285         <td><?php if ($userType !== false) { echo $userType->getName(); } ?></td>  
    286 286         <?php } ?>  
    287            
      287  
    287 287         <td>  
    288 288             <?php  
    289 289                 $creationDate = $row['time_created'];  
    290 290                 if ((int)$creationDate == 0) {  
    291                       echo "N/A";  
      291                     putGS('N/A');  
    291 291                 } else {  
    292 292                     echo strftime("%H:%M:%S %d.%m.%Y", strtotime($creationDate));  
    307 307 ?>  
    308 308     </tr>  
    309   <?php   
      309 <?php  
    309 309 }  
    310 310 ?>  
  • trunk/campsite/implementation/management/priv/users/subscriptions.php

    r4116 r4460  
    7 7 }  
    8 8  
      9 $publications = Publication::GetPublications();  
      10 $numSubscriptions = Subscription::GetNumSubscriptions(null, $editUser->getUserId());  
      11  
    9 12 ?>  
    10 13 <table border="0" cellspacing="1" cellpadding="3" width="100%" class="table_list">  
     
    14 17         <tr class="table_list_header">  
    15 18             <td align="left"><?php putGS("Subscriptions"); ?></td>  
      19 <?php  
      20 if (sizeof($publications) > $numSubscriptions) {  
      21 ?>  
    16 22             <td align="right" valign="center" nowrap>  
    17 23                 <?php $addURI = "/$ADMIN/users/subscriptions/add.php?f_user_id=".$editUser->getUserId(); ?>  
     
    19 25                 <a href="<?php echo $addURI; ?>"><B><?php putGS("Add new"); ?></B></A>  
    20 26             </td>  
      27 <?php  
      28 } // if (sizeof($publications) > $numSubscriptions)  
      29 ?>  
    21 30         </tr>  
    22 31         </table>  
     
    35 44         <TD ALIGN="LEFT" VALIGN="TOP" WIDTH="1%" ><B><?php  putGS("Delete"); ?></B></TD>  
    36 45     </TR>  
    37   <?php   
      46 <?php  
    37 46     foreach ($subscriptions as $subscription) {  
    38 47         $publicationObj =& new Publication($subscription->getPublicationId());  
     
    47 56         </TD>  
    48 57         <TD >  
    49               <?php   
      58             <?php  
    49 58             $sType = $subscription->getType();  
    50 59             if ($sType == 'T') {  
    68 77         </TD>  
    69 78     </TR>  
    70   <?php   
      79 <?php  
    70 79 }  
    71 80 ?>  
  • trunk/campsite/implementation/management/classes/DatabaseObject.php

    r4418 r4460  
    8 8  * Includes  
    9 9  */  
    10   // We indirectly reference the DOCUMENT_ROOT so we can enable  
    11   // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
      10 // We indirectly reference the DOCUMENT_ROOT so we can enable  
      11 // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
    12 12 // is not defined in these cases.  
    13 13 if (!isset($g_documentRoot)) {  
     
    34 34      */  
    35 35     var $m_columnNames = array();  
    36        
      36  
    36 36     /**  
    37 37      * The column names used for the key.  
     
    47 47      */  
    48 48     var $m_keyIsAutoIncrement = false;  
    49        
      49  
    49 49     /**  
    50 50      * An array of (ColumnName => Value).  
     
    59 59      */  
    60 60     var $m_exists = null;  
    61        
      61  
    61 61     /**  
    62 62      * If the key values of an object are changed, we need to remember the old  
     
    67 67      */  
    68 68     var $m_oldKeyValues = array();  
    69        
      69  
    69 69     /**  
    70 70      * DatabaseObject represents a row in a database table.  
     
    77 77      *  
    78 78      */  
    79       function DatabaseObject($p_columnNames = null)   
      79     function DatabaseObject($p_columnNames = null)  
    79 79     {  
    80 80         if (!is_null($p_columnNames)) {  
     
    83 83         }  
    84 84     } // constructor  
    85        
    86        
      85  
      86  
    87 87     /**  
    88 88      * Return the column names used for the primary key.  
     
    91 91     function getKeyColumnNames() { return $this->m_keyColumnNames; }  
    92 92  
    93        
      93  
    93 93     /**  
    94 94      * Return the column names of this table.  
     
    100 100      *  
    101 101      * @return array  
    102        */  
    103       function getColumnNames($p_withTablePrefix = false)  
    104       {  
      102      */  
      103     function getColumnNames($p_withTablePrefix = false)  
      104     {  
    105 105         if (!$p_withTablePrefix) {  
    106               return $this->m_columnNames;   
      106             return $this->m_columnNames;  
    106 106         } else {  
    107 107             $prefixNames = array();  
     
    124 124      * @return void  
    125 125      */  
    126       function setColumnNames($p_columnNames)   
      126     function setColumnNames($p_columnNames)  
    126 126     {  
    127 127         foreach ($p_columnNames as $columnName) {  
     
    130 130         }  
    131 131     } // fn setColumnNames  
    132        
    133        
      132  
      133  
    134 134     /**  
    135 135      * Return the row as an array indexed by the column names.  
     
    137 137      */  
    138 138     function getData() { return $this->m_data; }  
    139        
    140        
      139  
      140  
    141 141     /**  
    142 142      * Return the name of the database table.  
     
    144 144      */  
    145 145     function getDbTableName() { return $this->m_dbTableName; }  
    146        
    147        
      146  
      147  
    148 148     /**  
    149 149      * Return the key as an array indexed by column names.  
    150 150      * @return array  
    151 151      */  
    152       function getKey()   
      152     function getKey()  
    152 152     {  
    153 153         $key = array();  
     
    158 158         return $key;  
    159 159     } // fn getKey  
    160        
    161        
      160  
      161  
    162 162     /**  
    163 163      * This function has two modes of operation:  
     
    176 176      * @return void  
    177 177      */  
    178       function setKey($p_columnNames)   
      178     function setKey($p_columnNames)  
    178 178     {  
    179 179         if (is_array($p_columnNames)) {  
     
    189 189         }  
    190 190     } // fn setKey  
    191        
      191  
    191 191  
    192 192     /**  
     
    197 197      * @return void  
    198 198      */  
    199       function modifyKeyValue($p_columnName, $p_value)   
      199     function modifyKeyValue($p_columnName, $p_value)  
    199 199     {  
    200 200         if (!isset($this->m_oldKeyValues[$p_columnName])) {  
     
    204 204         $this->m_data[$p_columnName] = $p_value;  
    205 205     } // fn modifyKeyValue  
    206        
    207        
      206  
      207  
    208 208     /**  
    209 209      * Fetch a single record from the database for the given key.  
    210 210      *  
    211 211      * @param array $p_recordSet  
    212        *      If the record has already been fetched and we just need to   
      212      *      If the record has already been fetched and we just need to  
    212 212      *      assign the data to the object's internal member variable.  
    213 213      *  
     
    216 216      *      TRUE on success, FALSE on failure  
    217 217      */  
    218       function fetch($p_recordSet = null)   
      218     function fetch($p_recordSet = null)  
    218 218     {  
    219 219         global $Campsite;  
    220            
      220  
    220 220         if (is_null($p_recordSet)) {  
    221 221             $queryStr = 'SELECT ';  
     
    254 254         return true;  
    255 255     } // fn fetch  
    256        
    257        
      256  
      257  
    258 258     /**  
    259 259      * Return true if the object exists in the database.  
     
    261 261      * @return boolean  
    262 262      */  
    263       function exists()   
      263     function exists()  
    263 263     {  
    264 264         if (!is_null($this->m_exists)) {  
     
    274 274         return (count($resultSet) > 0);  
    275 275     } // fn exists  
    276        
    277        
      276  
      277  
    278 278     /**  
    279 279      * Return a string for the primary key of the table.  
     
    281 281      * @return string  
    282 282      */  
    283       function getKeyWhereClause()   
      283     function getKeyWhereClause()  
    283 283     {  
    284 284         $whereParts = array();  
     
    289 289             } else {  
    290 290                 $whereParts[] = '`' . $columnName . "`='"  
    291                       .mysql_real_escape_string($this->m_data[$columnName]) ."'";                   
      291                     .mysql_real_escape_string($this->m_data[$columnName]) ."'";  
    291 291             }  
    292           }             
    293           return implode(' AND ', $whereParts);         
      292         }  
      293         return implode(' AND ', $whereParts);  
    294 294     } // fn getKeyWhereClause  
    295        
    296        
      295  
      296  
    297 297     /**  
    298 298      * Return true if the object has all the values required  
     
    302 302      * @return boolean  
    303 303      */  
    304       function keyValuesExist()   
      304     function keyValuesExist()  
    304 304     {  
    305 305         foreach ($this->m_keyColumnNames as $columnName) {  
    306               if (!isset($this->m_data[$columnName]) || empty($this->m_data[$columnName])) {  
      306             if (!isset($this->m_data[$columnName]) /* || empty($this->m_data[$columnName]) */) {  
    306 306                 return false;  
    307 307             }  
     
    311 311         return true;  
    312 312     } // fn keyValuesExist  
    313        
    314        
      313  
      314  
    315 315     /**  
    316 316      * Create the record in the database for this object.  
    317 317      * This will use the currently set index values for the key.  
    318        * No other values are set unless they are passed in through   
      318      * No other values are set unless they are passed in through  
    318 318      * the $p_values parameter.  
    319 319      *  
     
    326 326      *      TRUE if the record was added, false if not.  
    327 327      */  
    328       function create($p_values = null)   
      328     function create($p_values = null)  
    328 328     {  
    329 329         global $Campsite;  
    330 330         $queryStr = 'INSERT IGNORE INTO ' . $this->m_dbTableName;  
    331            
      331  
    331 331         // Make sure we have the key required to create the row.  
    332 332         // If auto-increment is set, the database will create the key for us.  
     
    344 344             // the key is not an auto-increment value,  
    345 345             // so we cant create the row.  
    346               return false;             
      346             return false;  
    346 346         }  
    347            
      347  
    347 347         // Check if any columns values in the class are already set.  
    348 348         // If so, automatically set these values when we create the row.  
     
    354 354             }  
    355 355         }  
    356            
      356  
    356 356         // Optionally set some values when we create the row.  
    357 357         // These override values that are preset in the class.  
     
    373 373         $success = ($Campsite['db']->Affected_Rows() > 0);  
    374 374         $this->m_exists = $success;  
    375            
      375  
    375 375         // Fetch the row ID if it is auto-increment  
    376 376         if ($this->m_keyIsAutoIncrement) {  
    377 377             // There should only be one key column because  
    378 378             // its an auto-increment key.  
    379               $this->m_data[$this->m_keyColumnNames[0]] =   
      379             $this->m_data[$this->m_keyColumnNames[0]] =  
    379 379                 $Campsite['db']->Insert_ID();  
    380 380         }  
    381 381         return $success;  
    382 382     } // fn create  
    383        
    384        
      383  
      384  
    385 385     /**  
    386 386      * Delete the row from the database.  
     
    391 391      *      TRUE if the record was deleted, false if not.  
    392 392      */  
    393       function delete()   
      393     function delete()  
    393 393     {  
    394 394         global $Campsite;  
     
    399 399         $Campsite['db']->Execute($queryStr);  
    400 400         $wasDeleted = ($Campsite['db']->Affected_Rows() > 0);  
    401           // Always set "exists" to false because if a row wasnt   
      401         // Always set "exists" to false because if a row wasnt  
    401 401         // deleted it means it probably didnt exist in the first place.  
    402 402         $this->m_exists = false;  
     
    412 412      *  
    413 413      * @param boolean $p_forceFetchFromDatabase  
    414        *      Get the data from the database instead of cached value   
      414      *      Get the data from the database instead of cached value  
    414 414      *      that is stored in the object.  
    415        *   
      415      *  
    415 415      * @return mixed  
    416 416      *      Return a string if the property exists,  
     
    421 421      *      and there was a problem fetching the data.  
    422 422      */  
    423       function getProperty($p_dbColumnName, $p_forceFetchFromDatabase = false)   
      423     function getProperty($p_dbColumnName, $p_forceFetchFromDatabase = false)  
    423 423     {  
    424 424         global $Campsite;  
     
    452 452         return null;  
    453 453     } // fn getProperty  
    454        
    455        
      454  
      455  
    456 456     /**  
    457 457      * Set the given column name to the given value.  
     
    481 481      *      TRUE on success, FALSE on error.  
    482 482      */  
    483       function setProperty($p_dbColumnName, $p_value, $p_commit = true, $p_isSql = false)   
      483     function setProperty($p_dbColumnName, $p_value, $p_commit = true, $p_isSql = false)  
    483 483     {  
    484 484         global $Campsite;  
     
    551 551         return $databaseChanged;  
    552 552     } // fn setProperty  
    553        
    554        
      553  
      554  
    555 555     /**  
    556 556      * Update the database row with the given values.  
     
    572 572      * @return boolean  
    573 573      *      Return TRUE if the database was updated, FALSE otherwise.  
    574        *      This means that if p_commit is FALSE, this function will   
      574      *      This means that if p_commit is FALSE, this function will  
    574 574      *      always return false.  
    575 575      */  
    576       function update($p_columns = null, $p_commit = true, $p_isSql = false)   
      576     function update($p_columns = null, $p_commit = true, $p_isSql = false)  
    576 576     {  
    577 577         global $Campsite;  
    578            
      578  
    578 578         // Check input  
    579 579         if (!is_array($p_columns)) {  
     
    589 589             if (array_key_exists($columnName, $this->m_data)) {  
    590 590                 // Special case if we are setting a key value -  
    591                   // if we are going to commit later, then we need to   
      591                 // if we are going to commit later, then we need to  
    591 591                 // remember the old key values.  
    592 592                 if (!$p_commit && in_array($columnName, $this->m_keyColumnNames)) {  
     
    623 623     } // fn update  
    624 624  
    625        
      625  
    625 625     /**  
    626 626      * Commit the data stored in memory to the database.  
     
    636 636      *      Return TRUE if the database was updated, false otherwise.  
    637 637      */  
    638       function commit($p_ignoreColumns = null)   
      638     function commit($p_ignoreColumns = null)  
    638 638     {  
    639 639         global $Campsite;  
     
    658 658     } // fn commit  
    659 659  
    660        
      660  
    660 660     /**  
    661 661      * Do a simple search.  
     
    675 675             return array();  
    676 676         }  
    677            
      677  
    677 677         $tmpObj =& new $p_className;  
    678 678         $queryStr = "SELECT * FROM ".$tmpObj->m_dbTableName;  
     
    693 693     } // fn search  
    694 694  
    695        
      695  
    695 695     /**  
    696 696      * Output the raw values of this object so that it displays nice in HTML.  
     
    705 705     } // fn dumpToHtml  
    706 706  
    707        
      707  
    707 707     /**  
    708 708      * This is used by subclasses to add extra SQL options to the end of a query.  
    709        *   
      709      *  
    709 709      * @param string $p_queryStr  
    710 710      *      The current SQL query.  
     
    725 725      *      Original SQL query with the options appended at the end.  
    726 726      */  
    727       function ProcessOptions($p_queryStr, $p_sqlOptions)   
      727     function ProcessOptions($p_queryStr, $p_sqlOptions)  
    727 727     {  
    728 728         if (!is_null($p_sqlOptions)) {  
    729 729             if (isset($p_sqlOptions['ORDER BY'])) {  
    730 730                 if (!is_array($p_sqlOptions['ORDER BY'])) {  
    731                       $p_queryStr .= ' ORDER BY '.$p_sqlOptions['ORDER BY'];   
      731                     $p_queryStr .= ' ORDER BY '.$p_sqlOptions['ORDER BY'];  
    731 731                 } else {  
    732 732                     $p_queryStr .= ' ORDER BY ';  
    755 755                         .','.$p_sqlOptions['LIMIT']['MAX_ROWS'];  
    756 756                 } else {  
    757                       $p_queryStr .= ' LIMIT '.$p_sqlOptions['LIMIT'];                     
      757                     $p_queryStr .= ' LIMIT '.$p_sqlOptions['LIMIT'];  
    757 757                 }  
    758               }             
      758             }  
    758 758         }  
    759 759         return $p_queryStr;  
    760 760     } // fn ProcessOptions  
    761        
    762        
      761  
      762  
    763 763 } // class DatabaseObject  
    764 764  
  • trunk/campsite/implementation/management/classes/Section.php

    r4418 r4460  
    7 7  * Includes  
    8 8  */  
    9   // We indirectly reference the DOCUMENT_ROOT so we can enable  
    10   // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
      9 // We indirectly reference the DOCUMENT_ROOT so we can enable  
      10 // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
    11 11 // is not defined in these cases.  
    12 12 if (!isset($g_documentRoot)) {  
     
    23 23 class Section extends DatabaseObject {  
    24 24     var $m_dbTableName = 'Sections';  
    25       var $m_keyColumnNames = array('IdPublication',   
      25     var $m_keyColumnNames = array('IdPublication',  
    25 25                                   'NrIssue',  
    26 26                                   'IdLanguage',  
     
    38 38  
    39 39     var $m_languageName = null;  
    40        
      40  
    40 40     /**  
    41 41      * A section is a part of an issue.  
     
    46 46      * @param int $p_sectionNumber  
    47 47      */  
    48       function Section($p_publicationId = null, $p_issueId = null,  
    49                        $p_languageId = null, $p_sectionNumber = null)  
      48     function Section($p_publicationId = null, $p_issueId = null,  
      49                      $p_languageId = null, $p_sectionNumber = null)  
    50 50     {  
    51 51         parent::DatabaseObject($this->m_columnNames);  
     
    59 59     } // fn Section  
    60 60  
    61        
      61  
    61 61     /**  
    62 62      * Create a new Section.  
     
    75 75             if (function_exists("camp_load_language")) { camp_load_language("api"); }  
    76 76             $logtext = getGS('Section $1 added. (Issue: $2, Publication: $3)',  
    77                   $this->m_data['Name']." (".$this->m_data['Number'].")",  
    78                   $this->m_data['NrIssue'],  
    79                   $this->m_data['IdPublication']);  
      77                 $this->m_data['Name']." (".$this->m_data['Number'].")",  
      78                 $this->m_data['NrIssue'],  
      79                 $this->m_data['IdPublication']);  
    80 80             Log::Message($logtext, null, 21);  
    81 81         }  
    82 82         return $success;  
    83 83     } // fn create  
    84        
      84  
    84 84  
    85 85     /**  
     
    92 92      * @param int $p_destIssueId  
    93 93      *     The destination issue ID.  
    94        * @param int $p_destIssueLanguageId  
    95        *     (optional) The destination issue language ID.  If not given,  
      94      * @param int $p_destIssueLanguageId  
      95      *     (optional) The destination issue language ID.  If not given,  
    96 96      *     it will use the language ID of this section.  
    97 97      * @param int $p_destSectionId  
    98        *     (optional) The destination section ID.  If not given, a new   
      98      *     (optional) The destination section ID.  If not given, a new  
    98 98      *     section will be created.  
    99 99      * @param boolean $p_copyArticles  
     
    104 104      *     The new Section object.  
    105 105      */  
    106       function copy($p_destPublicationId, $p_destIssueId, $p_destIssueLanguageId = null,   
      106     function copy($p_destPublicationId, $p_destIssueId, $p_destIssueLanguageId = null,  
    106 106                   $p_destSectionId = null, $p_copyArticles = true) {  
    107 107         if (is_null($p_destIssueLanguageId)) {  
    108              $p_destIssueLanguageId = $this->m_data['IdLanguage'];     
      108            $p_destIssueLanguageId = $this->m_data['IdLanguage'];  
    108 108         }  
    109 109         if (is_null($p_destSectionId)) {  
    110 110             $p_destSectionId = $this->m_data['Number'];  
    111 111         }  
    112           $dstSectionObj =& new Section($p_destPublicationId, $p_destIssueId,   
      112         $dstSectionObj =& new Section($p_destPublicationId, $p_destIssueId,  
    112 112                                       $p_destIssueLanguageId, $p_destSectionId);  
    113 113         // If source issue and destination issue are the same  
    114           if ( ($this->m_data['IdPublication'] == $p_destPublicationId)   
      114         if ( ($this->m_data['IdPublication'] == $p_destPublicationId)  
    114 114               && ($this->m_data['NrIssue'] == $p_destIssueId)  
    115 115               && ($this->m_data['IdLanguage'] == $p_destIssueLanguageId) ) {  
     
    127 127         $dstSectionCols['SectionTplId'] = $this->m_data['SectionTplId'];  
    128 128         $dstSectionCols['ArticleTplId'] = $this->m_data['ArticleTplId'];  
    129            
      129  
    129 129         // Create the section if it doesnt exist yet.  
    130 130         if (!$dstSectionObj->exists()) {  
    131 131             $dstSectionObj->create($sectionName, $shortName, $dstSectionCols);  
    132 132         }  
    133            
      133  
    133 133         // Copy all the articles.  
    134 134         if ($p_copyArticles) {  
    135               $srcSectionArticles = Article::GetArticles($this->m_data['IdPublication'],  
    136                                                          $this->m_data['NrIssue'],  
      135             $srcSectionArticles = Article::GetArticles($this->m_data['IdPublication'],  
      136                                                        $this->m_data['NrIssue'],  
    137 137                                                        $this->m_data['Number']);  
    138 138             $copiedArticles = array();  
    139 139             foreach ($srcSectionArticles as $articleObj) {  
    140 140                 if (!in_array($articleObj->getArticleNumber(), $copiedArticles)) {  
    141                       $tmpCopiedArticles = $articleObj->copy($p_destPublicationId,   
      141                     $tmpCopiedArticles = $articleObj->copy($p_destPublicationId,  
    141 141                         $p_destIssueId, $p_destSectionId, null, true);  
    142 142                     $copiedArticles[] = $articleObj->getArticleNumber();  
     
    147 147             }  
    148 148         }  
    149                    
      149  
    149 149         return $dstSectionObj;  
    150 150     } // fn copy  
    151 151  
    152        
      152  
    152 152     /**  
    153 153      * Delete the section, and optionally the articles.  
     
    157 157      * @return boolean  
    158 158      */  
    159       function delete($p_deleteArticles = false)   
      159     function delete($p_deleteArticles = false)  
    159 159     {  
    160 160         $numArticlesDeleted = 0;  
    161 161         if ($p_deleteArticles) {  
    162               $articles = Article::GetArticles($this->m_data['IdPublication'],   
      162             $articles = Article::GetArticles($this->m_data['IdPublication'],  
    162 162                                               $this->m_data['NrIssue'],  
    163 163                                               $this->m_data['Number']);  
     
    180 180         return $numArticlesDeleted;  
    181 181     } // fn delete  
    182        
    183            
      182  
      183  
    184 184     /**  
    185 185      * @return int  
    186 186      */  
    187       function getPublicationId()   
      187     function getPublicationId()  
    187 187     {  
    188 188         return $this->getProperty('IdPublication');  
    189 189     } // fn getPublicationId  
    190        
    191        
      190  
      191  
    192 192     /**  
    193 193      * @return int  
    194 194      */  
    195       function getIssueNumber()   
      195     function getIssueNumber()  
    195 195     {  
    196 196         return $this->getProperty('NrIssue');  
    197 197     } // fn getIssueNumber  
    198        
    199        
      198  
      199  
    200 200     /**  
    201 201      * @return int  
    202 202      */  
    203       function getLanguageId()   
      203     function getLanguageId()  
    203 203     {  
    204 204         return $this->getProperty('IdLanguage');  
    205 205     } // fn getLanguageId  
    206        
    207        
      206  
      207  
    208 208     /**  
    209        * A simple way to get the name of the language the article is   
      209      * A simple way to get the name of the language the article is  
    209 209      * written in.  The value is cached in case there are multiple  
    210 210      * calls to this function.  
     
    216 216      * @return string  
    217 217      */  
    218       function getLanguageName()   
      218     function getLanguageName()  
    218 218     {  
    219 219         if (is_null($this->m_languageName)) {  
     
    222 222             $this->m_languageName = $language->getNativeName();  
    223 223         }  
    224           return $this->m_languageName;         
      224         return $this->m_languageName;  
    224 224     } // fn getLanguageName  
    225        
    226        
      225  
      226  
    227 227     /**  
    228 228      * @return int  
    229 229      */  
    230       function getSectionNumber()   
      230     function getSectionNumber()  
    230 230     {  
    231 231         return $this->getProperty('Number');  
    232 232     } // fn getSectionNumber  
    233 233  
    234        
      234  
    234 234     /**  
    235 235      * @return string  
    236        */  
    237       function getName()  
      236      */  
      237     function getName()  
    238 238     {  
    239 239         return $this->getProperty('Name');  
    240 240     } // fn getName  
    241        
    242        
      241  
      242  
    243 243     /**  
    244 244      * @param string $p_value  
    245 245      * @return boolean  
    246 246      */  
    247       function setName($p_value)   
      247     function setName($p_value)  
    247 247     {  
    248 248         return $this->setProperty('Name', $p_value);  
    249 249     } // fn setName  
    250        
    251        
      250  
      251  
    252 252     /**  
    253 253      * @return string  
    254 254      */  
    255       function getUrlName()   
      255     function getUrlName()  
    255 255     {  
    256 256         return $this->getProperty('ShortName');  
    257 257     } // fn getUrlName  
    258        
    259        
      258  
      259  
    260 260     /**  
    261 261      * @param string $p_name  
    262 262      */  
    263       function setUrlName($p_name)   
      263     function setUrlName($p_name)  
    263 263     {  
    264 264         return $this->setProperty('ShortName', $p_name);  
    265 265     } // fn setUrlName  
    266        
    267        
      266  
      267  
    268 268     /**  
    269 269      * @return int  
    270 270      */  
    271       function getArticleTemplateId()   
      271     function getArticleTemplateId()  
    271 271     {  
    272 272         return $this->getProperty('ArticleTplId');  
    273 273     } // fn getArticleTemplateId  
    274        
    275        
      274  
      275  
    276 276     /**  
    277 277      * @param int $p_value  
     
    289 289         return $this->setProperty('ArticleTplId', $p_value);  
    290 290     } // fn setArticleTemplateId  
    291        
    292        
      291  
      292  
    293 293     /**  
    294 294      * @return int  
    295 295      */  
    296       function getSectionTemplateId()   
      296     function getSectionTemplateId()  
    296 296     {  
    297 297         return $this->getProperty('SectionTplId');  
    298 298     } // fn getSectionTemplateId  
    299        
    300        
      299  
      300  
    301 301     /**  
    302 302      * @param int $p_value  
    303 303      * @return boolean  
    304 304      */  
    305       function setSectionTemplateId($p_value)   
      305     function setSectionTemplateId($p_value)  
    305 305     {  
    306 306         return $this->setProperty('SectionTplId', $p_value);  
    307 307     } // fn setSectionTemplateId  
    308        
    309        
      308  
      309  
    310 310     /**  
    311 311      * Return an array of sections in the given issue.  
     
    327 327      */  
    328 328     function GetSections($p_publicationId = null, $p_issueId = null,  
    329                            $p_languageId = null, $p_sqlOptions = null)   
      329                          $p_languageId = null, $p_sqlOptions = null)  
    329 329     {  
    330 330         $constraints = array();  
     
    339 339             $constraints[] = array("IdLanguage", $p_languageId);  
    340 340         }  
    341            
      341  
    341 341         return DatabaseObject::Search('Section', $constraints, $p_sqlOptions);  
    342 342     } // fn GetSections  
    343        
    344        
      343  
      344  
    345 345     /**  
    346 346      * Return an array of arrays indexed by "id" and "name".  
    347 347      * @return array  
    348 348      */  
    349       function GetUniqueSections($p_publicationId)  
      349     function GetUniqueSections($p_publicationId, $p_byLanguage = false)  
    349 349     {  
    350 350         global $Campsite;  
    351           $tmpObj =& new Section();         
    352           $queryStr = "SELECT DISTINCT Number as id, Name as name "  
    353                       ." FROM ".$tmpObj->m_dbTableName  
    354                       ." WHERE IdPublication=$p_publicationId";  
      351         $queryStr = "SELECT Number as id, s.Name as name, s.IdLanguage, l.Name as LangName "  
      352                     ." FROM Sections AS s LEFT JOIN Languages AS l ON s.IdLanguage = l.Id"  
      353                     ." WHERE s.IdPublication = $p_publicationId"  
      354                     ." GROUP BY s.Number";  
      355         if ($p_byLanguage) {  
      356             $queryStr .= ", s.IdLanguage";  
      357         }  
    355 358         return $Campsite['db']->GetAll($queryStr);  
    356 359     } // fn GetSectionNames  
    357        
    358        
      360  
      361  
    359 362     /**  
    360 363      * Return the total number of sections according to the given values.  
     
    366 369      * @return int  
    367 370      */  
    368       function GetTotalSections($p_publicationId = null, $p_issueId = null, $p_languageId = null)   
      371     function GetTotalSections($p_publicationId = null, $p_issueId = null, $p_languageId = null)  
    368 371     {  
    369 372         global $Campsite;  
     
    386 389         return $total;  
    387 390     } // fn GetTotalSections  
    388        
    389        
      391  
      392  
      393     function GetNumUniqueSections($p_publicationId, $p_byLanguage = true)  
      394     {  
      395         global $Campsite;  
      396         $queryStr = "SELECT * FROM Sections WHERE IdPublication = $p_publicationId"  
      397             ." GROUP BY Number";  
      398         if ($p_byLanguage) {  
      399             $queryStr .= ', IdLanguage';  
      400         }  
      401         $result = $Campsite['db']->Execute($queryStr);  
      402         return $result->RowCount();  
      403     }  
      404  
      405  
    390 406     /**  
    391 407      * Return a section number that is not in use.  
     
    395 411      * @return int  
    396 412      */  
    397       function GetUnusedSectionId($p_publicationId, $p_issueId, $p_languageId)   
      413     function GetUnusedSectionId($p_publicationId, $p_issueId, $p_languageId)  
    397 413     {  
    398 414         global $Campsite;  
    407 423         return $number;  
    408 424     } // fn GetUnusedSectionId  
    409            
      425  
    409 425 } // class Section  
    410 426 ?>  
  • trunk/campsite/implementation/management/classes/Publication.php

    r4161 r4460  
    7 7  * Includes  
    8 8  */  
    9   // We indirectly reference the DOCUMENT_ROOT so we can enable  
    10   // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
      9 // We indirectly reference the DOCUMENT_ROOT so we can enable  
      10 // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
    11 11 // is not defined in these cases.  
    12 12 if (!isset($g_documentRoot)) {  
     
    17 17 require_once($g_documentRoot.'/classes/DbObjectArray.php');  
    18 18 require_once($g_documentRoot.'/classes/ParserCom.php');  
      19 require_once($g_documentRoot.'/classes/Language.php');  
    19 20  
    20 21 /**  
     
    25 26     var $m_keyColumnNames = array('Id');  
    26 27     var $m_keyIsAutoIncrement = true;  
    27       var $m_columnNames = array('Id',  
    28                                  'Name',  
    29                                  'IdDefaultLanguage',  
    30                                  'PayTime',  
    31                                  'TimeUnit',  
    32                                  'UnitCost',  
    33                                  'Currency',  
    34                                  'TrialTime',  
    35                                  'PaidTime',  
    36                                  'IdDefaultAlias',  
      28     var $m_columnNames = array('Id',  
      29                                'Name',  
      30                                'IdDefaultLanguage',  
      31                                'TimeUnit',  
      32                                'UnitCost',  
      33                                'UnitCostAllLang',  
      34                                'Currency',  
      35                                'TrialTime',  
      36                                'PaidTime',  
      37                                'IdDefaultAlias',  
    37 38                                'IdURLType');  
    38        
      39  
    38 39     /**  
    39 40      * @param int $p_publicationId  
    40 41      */  
    41       function Publication($p_publicationId = null)   
      42     function Publication($p_publicationId = null)  
    41 42     {  
    42 43         parent::DatabaseObject($this->m_columnNames);  
     
    49 50     } // constructor  
    50 51  
    51        
    52       function create($p_values = null)  
      52  
      53     function create($p_values = null)  
    53 54     {  
    54           $created = parent::create($p_values);     
      55         $created = parent::create($p_values);  
    54 55         if ($created) {  
    55 56             if (function_exists("camp_load_language")) { camp_load_language("api"); }  
    56               $logtext = getGS('Publication $1 added', $this->m_data['Name']." (".$this->m_data['Id'].")");   
      57             $logtext = getGS('Publication $1 added', $this->m_data['Name']." (".$this->m_data['Id'].")");  
    56 57             Log::Message($logtext, null, 1);  
    57 58             ParserCom::SendMessage('publication', 'create', array("IdPublication" => $this->m_data['Id']));  
     
    61 62         return $created;  
    62 63     } // fn create  
    63        
    64        
      64  
      65  
    65 66     function update($p_columns = null, $p_commit = true, $p_isSql = false)  
    66 67     {  
     
    68 69         if ($updated) {  
    69 70             if (function_exists("camp_load_language")) { camp_load_language("api"); }  
    70               $logtext = getGS('Publication $1 changed', $this->m_data['Name']." (".$this->m_data['Id'].")");  
    71               Log::Message($logtext, null, 3);         
      71             $logtext = getGS('Publication $1 changed', $this->m_data['Name']." (".$this->m_data['Id'].")");  
      72             Log::Message($logtext, null, 3);  
    72 73             ParserCom::SendMessage('publication', 'modify', array("IdPublication" => $this->m_data['Id']));  
    73 74         }  
    74 75         return $updated;  
    75 76     } // fn update  
    76        
    77        
    78       function delete()  
      77  
      78  
      79     function delete()  
    79 80     {  
    80 81         $aliases = Alias::GetAliases(null, $this->m_data['Id']);  
     
    87 88         if ($deleted) {  
    88 89             if (function_exists("camp_load_language")) { camp_load_language("api"); }  
    89               $logtext = getGS('Publication $1 deleted', $this->m_data['Name']." (".$this->m_data['Id'].")");   
      90             $logtext = getGS('Publication $1 deleted', $this->m_data['Name']." (".$this->m_data['Id'].")");  
    89 90             Log::Message($logtext, null, 2);  
    90               ParserCom::SendMessage('publication', 'delete', array("IdPublication" => $this->m_data['Id']));           
      91             ParserCom::SendMessage('publication', 'delete', array("IdPublication" => $this->m_data['Id']));  
    90 91         }  
    91 92         return $deleted;  
    92 93     } // fn delete  
    93        
    94        
      94  
      95  
    95 96     /**  
    96 97      * @return int  
    97 98      */  
    98       function getPublicationId()   
      99     function getPublicationId()  
    98 99     {  
    99 100         return $this->getProperty('Id');  
    100 101     } // fn getPublicationId  
    101        
    102        
      102  
      103  
    103 104     /**  
    104 105      * @return string  
    105 106      */  
    106       function getName()   
      107     function getName()  
    106 107     {  
    107 108         return $this->getProperty('Name');  
    108 109     } // fn getName  
    109 110  
    110        
      111  
    110 111     /**  
    111 112      * @return int  
    112 113      */  
    113       function getLanguageId()   
      114     function getLanguageId()  
    113 114     {  
    114 115         return $this->getProperty('IdDefaultLanguage');  
    115 116     } // fn getLanguageId  
    116        
    117        
      117  
      118  
    118 119     /**  
    119 120      * @return string  
    120 121      */  
    121       function getTimeUnit()   
      122     function getTimeUnit()  
    121 122     {  
    122 123         return $this->getProperty('TimeUnit');  
    123 124     } // fn getTimeUnit  
    124        
      125  
    124 125  
    125 126     /**  
     
    138 139         return $this->getProperty('IdDefaultAlias');  
    139 140     } // fn getDefaultAliasId  
    140        
    141        
      141  
      142  
    142 143     /**  
    143 144      * @return int  
     
    147 148         return $this->getProperty('IdDefaultLanguage');  
    148 149     } // fn getDefaultLanguageId  
    149        
    150        
      150  
      151  
    151 152     /**  
    152 153      * @return int  
     
    156 157         return $this->getProperty('IdURLType');  
    157 158     } // fn getUrlTypeId  
    158        
    159        
      159  
      160  
    160 161     /**  
    161        * @return int  
      162      * @return float  
    161 162      */  
    162       function getPayTime()  
      163     function getUnitCost()  
    162 163     {  
    163           return $this->getProperty('PayTime');  
    164       } // fn getPayTime  
    165        
    166        
      164         return $this->getProperty('UnitCost');  
      165     } // fn getUnitCost  
      166  
      167  
    167 168     /**  
    168 169      * @return float  
    169 170      */  
    170       function getUnitCost()  
      171     function getUnitCostAllLang()  
    170 171     {  
    171           return $this->getProperty('UnitCost');  
      172         return $this->getProperty('UnitCostAllLang');  
    171 172     } // fn getUnitCost  
    172        
    173        
      173  
      174  
    174 175     /**  
    175 176      * @return string  
    176 177      */  
    177       function getCurrency()   
      178     function getCurrency()  
    177 178     {  
    178 179         return $this->getProperty('Currency');  
    179 180     } // fn getCurrency  
    180        
    181        
      181  
      182  
    182 183     /**  
    183 184      * @return int  
     
    192 193         return $this->getProperty('PaidTime');  
    193 194     } // fn getPaidTime  
    194        
    195        
      195  
      196  
    196 197     /**  
    197 198      * @return int  
     
    201 202         return $this->getProperty('TrialTime');  
    202 203     } // fn getTrialTime  
    203        
    204        
      204  
      205  
      206     /**  
      207      * Return all languages used in the publication as an array of Language objects.  
      208      * @return array  
      209      */  
      210     function getLanguages($p_sqlOptions = null)  
      211     {  
      212         if (is_null($p_sqlOptions)) {  
      213             $p_sqlOptions = array();  
      214         }  
      215         if (!isset($p_sqlOptions["ORDER BY"])) {  
      216             $p_sqlOptions["ORDER BY"] = array("l.Name" => "ASC");  
      217         }  
      218         $queryStr = 'SELECT l.* FROM Issues AS i LEFT JOIN Languages AS l ON i.IdLanguage = l.Id '  
      219                 . 'WHERE i.IdPublication = ' . $this->getPublicationId() . ' GROUP BY IdLanguage';  
      220         $queryStr = DatabaseObject::ProcessOptions($queryStr, $p_sqlOptions);  
      221         $languages = DbObjectArray::Create('Language', $queryStr);  
      222         return $languages;  
      223     }  
      224  
      225  
    205 226     /**  
    206 227      * Return the total number of publications.  
     
    213 234         return $Campsite['db']->GetOne($queryStr);  
    214 235     } // fn GetNumPublications  
    215        
    216        
      236  
      237  
    217 238     /**  
    218 239      * Return all publications as an array of Publication objects.  
    219 240      * @return array  
    220 241      */  
    221       function GetPublications($p_sqlOptions = null)   
      242     function GetPublications($p_sqlOptions = null)  
    221 242     {  
    222 243         if (is_null($p_sqlOptions)) {  
    237 258                     .' AND Publications.IdURLType = URLTypes.Id '  
    238 259                     .' AND Publications.IdDefaultLanguage = Languages.Id ';  
    239           $queryStr = DatabaseObject::ProcessOptions($queryStr, $p_sqlOptions);                     
      260         $queryStr = DatabaseObject::ProcessOptions($queryStr, $p_sqlOptions);  
    239 260         $publications = DbObjectArray::Create('Publication', $queryStr);  
    240 261         return $publications;  
    241 262     } // fn getPublications  
    242        
      263  
    242 263 } // class Publication  
    243 264 ?>  
  • trunk/campsite/implementation/management/classes/SubscriptionSection.php

    r4270 r4460  
    3 3  * Includes  
    4 4  */  
    5   // We indirectly reference the DOCUMENT_ROOT so we can enable  
    6   // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
      5 // We indirectly reference the DOCUMENT_ROOT so we can enable  
      6 // scripts to use this file from the command line, $_SERVER['DOCUMENT_ROOT']  
    7 7 // is not defined in these cases.  
    8 8 if (!isset($g_documentRoot)) {  
     
    14 14 class SubscriptionSection extends DatabaseObject {  
    15 15     var $m_dbTableName = 'SubsSections';  
    16       var $m_keyColumnNames = array('IdSubscription', 'SectionNumber');  
      16     var $m_keyColumnNames = array('IdSubscription', 'SectionNumber', 'IdLanguage');  
    16 16     var $m_columnNames = array(  
    17 17         'IdSubscription',  
    18 18         'SectionNumber',  
      19         'IdLanguage',  
    19 20         'StartDate',  
    20 21         'Days',  
    21 22         'PaidDays',  
    22 23         'NoticeSent');  
    23        
    24            
    25       function SubscriptionSection($p_subscriptionId = null, $p_sectionNumber = null)  
      24  
      25  
      26     function SubscriptionSection($p_subscriptionId = null, $p_sectionNumber = null, $p_languageId = null)  
    26 27     {  
    27 28         parent::DatabaseObject($this->m_columnNames);  
    28 29         $this->m_data['IdSubscription'] = $p_subscriptionId;  
    29 30         $this->m_data['SectionNumber'] = $p_sectionNumber;  
      31         $this->m_data['IdLanguage'] = $p_languageId;  
    30 32         if ($this->keyValuesExist()) {  
    31 33             $this->fetch();  
    32 34         }  
    33 35     } // constructor  
    34        
    35        
      36  
      37  
    36 38     function delete()  
    37 39     {  
     
    43 45         return $deleted;  
    44 46     } // fn delete  
    45        
    46        
      47  
      48  
    47 49     function getSubscriptionId()  
    48 50     {  
    49 51         return $this->getProperty('IdSubscription');  
    50 52     } // fn getSubscriptionId  
    51        
    52        
      53  
      54  
    53 55     function getSectionNumber()  
    54 56     {  
    55 57         return $this->getProperty('SectionNumber');  
    56 58     } // fn getSectionNumber  
    57        
    58        
      59  
      60  
      61     function getLanguageId()  
      62     {  
      63         return $this->getProperty('IdLanguage');  
      64     } // fn getSubscriptionId  
      65  
      66  
    59 67     function getStartDate()  
    60 68     {  
    61 69         return $this->getProperty('StartDate');  
    62 70     } // fn getStartDate  
    63        
    64        
      71  
      72  
    65 73     function setStartDate($p_value)  
    66 74     {  
    67 75         return $this->setProperty('StartDate', $p_value);  
    68 76     }  
    69        
    70        
      77  
      78  
    71 79     function getDays()  
    72 80     {  
    73 81         return $this->getProperty('Days');  
    74 82     } // fn getDays  
    75        
    76        
      83  
      84  
    77 85     function setDays($p_value)  
    78 86     {  
    79 87         return $this->setProperty('Days', $p_value);  
    80 88     }  
    81        
    82        
      89  
      90  
    83 91     function getPaidDays()  
    84 92     {  
    85 93         return $this->getProperty('PaidDays');  
    86 94     } // fn getPaidDays  
    87        
    88        
      95  
      96  
    89 97     function setPaidDays($p_value)  
    90 98     {  
    91 99         return $this->setProperty('PaidDays', $p_value);  
    92 100     }  
    93        
    94        
      101  
      102  
    95 103     /**  
    96 104      * @return boolean  
     
    105 113         }  
    106 114     } // fn noticeSent  
    107        
    108        
      115  
      116  
    109 117     /**  
    110 118      *  
    111 119      * @param int $p_subscriptionId  
    112 120      * @param int $p_publicationId  
      121      * @param int $p_languageId  
    113 122      * @param array $p_values  
    114 123      * @return boolean  
    115 124      */  
    116       function AddSubscriberToPublication($p_subscriptionId, $p_publicationId, $p_values = null)  
      125     function AddSubscriberToPublication($p_subscriptionId, $p_publicationId, $p_languageId, $p_values = null)  
    116 125     {  
    117 126         global $Campsite;  
     
    121 130         $sectionIds = $Campsite['db']->GetCol($queryStr);  
    122 131         foreach ($sectionIds as $sectionId) {  
    123               $subscriptionSection =& new SubscriptionSection($p_subscriptionId, $sectionId);  
      132             $subscriptionSection =& new SubscriptionSection($p_subscriptionId, $sectionId, $p_languageId);  
    123 132             $created &= $subscriptionSection->create($p_values);  
    124 133         }  
    125 134         return $created;  
    126 135     }  
    127        
    128        
    129       function GetSubscriptionSections($p_subscriptionId, $p_sectionId = null)  
    130       {  
    131           $queryStr = "SELECT DISTINCT SubsSections.*, Sections.Name, Subscriptions.Type "  
    132               ." FROM SubsSections, Sections, Subscriptions "  
    133               ." WHERE SubsSections.IdSubscription=$p_subscriptionId "  
    134               ." AND Subscriptions.Id = $p_subscriptionId"  
      136  
      137  
      138     function GetSubscriptionSections($p_subscriptionId, $p_sectionId = null, $p_languageId = null)  
      139     {  
      140         $queryStr = "SELECT SubsSections.*, Sections.Name, Subscriptions.Type, "  
      141             ."Languages.Name as LangName, Languages.OrigName as LangOrigName"  
      142             ." FROM Subscriptions, Sections, SubsSections LEFT JOIN Languages "  
      143             ." ON SubsSections.IdLanguage = Languages.Id "  
      144             ." WHERE Subscriptions.Id = $p_subscriptionId "  
      145             ." AND Subscriptions.Id = SubsSections.IdSubscription "  
    135 146             ." AND Subscriptions.IdPublication = Sections.IdPublication "  
    136 147             ." AND SubsSections.SectionNumber = Sections.Number ";  
    139 150             $queryStr .= " AND SubsSections.SectionNumber = $p_sectionId";  
    140 151         }  
    141           $queryStr .= " ORDER BY SectionNumber";  
      152         if (!is_null($p_languageId)) {  
      153             $queryStr .= " AND SubsSections.IdLanguage = $p_languageId";  
      154         }  
      155         $queryStr .= " GROUP BY SectionNumber, IdLanguage ORDER BY SectionNumber, LangName";  
    142 156         $sections = DbObjectArray::Create('SubscriptionSection', $queryStr);  
    143 157         return $sections;  
    144 158     }  
    145        
      159  
      160  
      161     function GetNumSections($p_subscriptionId, $p_sectionId = null, $p_languageId = null)  
      162     {  
      163         global $Campsite;  
      164         $queryStr = "SELECT count(*) FROM SubsSections WHERE IdSubscription = $p_subscriptionId";  
      165         if (!is_null($p_sectionId)) {  
      166             if (is_array($p_sectionId)) {  
      167                 $queryStr .= " AND SectionNumber IN (" . implode(", ", $p_sectionId) . ")";  
      168             } else {  
      169                 $queryStr .= " AND SectionNumber = $p_sectionId";  
      170             }  
      171         }  
      172         if (!is_null($p_languageId)) {  
      173             if (is_array($p_languageId)) {  
      174                 $queryStr .= " AND IdLanguage IN (" . implode(", ", $p_languageId) . ")";  
      175             } else {  
      176                 $queryStr .= " AND IdLanguage = $p_languageId";  
      177             }  
      178         } else {  
      179             $queryStr .= " AND IdLanguage != 0";  
      180         }  
      181         $total = $Campsite['db']->GetOne($queryStr);  
      182         return $total;  
      183     }  
      184  
    146 185 } // class SubscriptionSection  
    147 186 ?>  
  • trunk/campsite/implementation/management/parser_utils.php

    r4274 r4460  
    13 13 {  
    14 14     global $Campsite;  
    15        
      15  
    15 15     $binFile = $Campsite['BIN_DIR'] . "/campsite_server";  
    16 16     $args = " -i " . $Campsite['DATABASE_NAME'];  
     
    34 34 {  
    35 35     global $Campsite;  
    36        
      36  
    36 36     $instanceName = $Campsite['DATABASE_NAME'];  
    37 37     $cmd = "ps -o pid=pid,cmd=command -C campsite_server";  
     
    64 64 /**  
    65 65  * Send a message to the campsite parser.  Note to third-party developers:  
    66    * use the ParserCom class for this.  These will be merged together in the   
      66  * use the ParserCom class for this.  These will be merged together in the  
    66 66  * future.  
    67 67  *  
     
    70 70  * @param boolean $p_closeSocket  
    71 71  * @return mixed  
    72    *      If $p_closeSocket is TRUE, return NULL, if it is FALSE, return   
      72  *      If $p_closeSocket is TRUE, return NULL, if it is FALSE, return  
    72 72  *      a socket.  
    73 73  */  
     
    157 157         camp_debug_msg("  $name = $value");  
    158 158     }  
    159        
      159  
    159 159     $msg = "<CampsiteMessage MessageType=\"URLRequest\">\n";  
    160 160     $msg .= "\t<HTTPHost>" . camp_xmlescape($p_envVars['HTTP_HOST']) . "</HTTPHost>\n";  
     
    167 167     $msg .= "\t<Parameters>\n";  
    168 168     foreach ($p_parameters as $param_name=>$param_value) {  
    169           $msg .= "\t\t<Parameter Name=\"" . camp_xmlescape($param_name)  
    170               . "\" Type=\"string\">" . camp_xmlescape($param_value) . "</Parameter>\n";  
      169         if (is_array($param_value)) {  
      170             foreach ($param_value as $list_param_value) {  
      171                 $msg .= "\t\t<Parameter Name=\"" . camp_xmlescape($param_name)  
      172                     . "\" Type=\"string\">" . camp_xmlescape($list_param_value) . "</Parameter>\n";  
      173             }  
      174         } else {  
      175             $msg .= "\t\t<Parameter Name=\"" . camp_xmlescape($param_name)  
      176                 . "\" Type=\"string\">" . camp_xmlescape($param_value) . "</Parameter>\n";  
      177         }  
    171 178     }  
    172 179     $msg .= "\t</Parameters>\n";  
     
    215 222     foreach ($pairs as $pair) {  
    216 223         $pair_array = explode("=", $pair);  
    217           if (trim($pair_array[0]) != "") {  
    218               $parameters[trim($pair_array[0])] = urldecode(trim($pair_array[1]));  
      224         $paramName = trim($pair_array[0]);  
      225         $paramValue = trim($pair_array[1]);  
      226         if ($paramName == "") {  
      227             continue;  
      228         }  
      229         if (isset($parameters[$paramName])) {  
      230             if (is_array($parameters[$paramName])) {  
      231                 $parameters[$paramName][] = $paramValue;  
      232             } else {  
      233                 $parameters[$paramName] = array($parameters[$paramName], urldecode($paramValue));  
      234             }  
      235             continue;  
    219 236         }  
      237         $parameters[$paramName] = $paramValue;  
    220 238     }  
    221 239     return $parameters;  
    307 325         echo "<p>";  
    308 326     }  
    309        
      327  
    309 327     echo $msg;  
    310 328     if ($format_html) {  
  • trunk/campsite/implementation/management/cgi/tpl_cgi.cpp

    r4258 r4460  
    295 295     {  
    296 296         CXMLTree::iterator coParamIt = coTree.newChild(coNodeIt, "Parameter", pchValue);  
    297           coTree.addAttribute(coParamIt, "Name", pchParam);  
      297         string coParam = pchParam;  
      298         if (coParam.rfind("[]") == (coParam.size() - 2))  
      299         {  
      300             coParam = coParam.substr(0, coParam.size() - 2);  
      301         }  
      302         coTree.addAttribute(coParamIt, "Name", coParam.c_str());  
    298 303         coTree.addAttribute(coParamIt, "Type", "string");  
    299 304     }  
  • trunk/campsite/implementation/parser/parser/actions.h

    r4436 r4460  
    950 950     //      CContext& c - current context  
    951 951     //      sockstream& fs - output stream  
    952       virtual int takeAction(CContext& c, sockstream& fs)  
    953       {  
    954           if (m_bInsertSpace)  
    955           {  
    956               fs << ' ';  
    957           }  
    958           fs.write(text, text_len);  
    959           return RES_OK;  
    960       }  
      952     virtual int takeAction(CContext& c, sockstream& fs);  
    961 953 };  
    962 954  
    1096 1088     string female_name;         // female noun in current language  
    1097 1089     bool checked;               // true if field is checked  
      1090     string m_coClass;           // set the HTML element class (for CSS stylesheets)  
      1091     int m_nSize;                // size of the selection box for multiple select elements  
      1092     bool m_bMultipleSelect;     // if true create multiple select box  
    1098 1093  
    1099 1094 public:  
    1100 1095     // constructor  
    1101       CActSelect(int m, const string& f, string mn = "", string fn = "", bool ck = false)  
    1102           throw(InvalidModifier)  
    1103           : modifier(m), field(f), male_name(mn), female_name(fn), checked(ck)  
      1096     CActSelect(int m, const string& f, string mn = "", string fn = "", bool ck = false,  
      1097                string p_coClass = "", int p_nSize = 3, bool p_bMultipleSelect = false)  
      1098             throw(InvalidModifier)  
      1099     : modifier(m), field(f), male_name(mn), female_name(fn), checked(ck), m_coClass(p_coClass),  
      1100     m_nSize(p_nSize), m_bMultipleSelect(p_bMultipleSelect)  
    1104 1101     {  
    1105 1102         if (!s_coModifiers.validModifier(m))  
  • trunk/campsite/implementation/parser/parser/parser.cpp

    r4436 r4460  
    166 166 #define CheckForText(al, l)\  
    167 167 {\  
    168   if (l->textStart() && l->textLen() > 0)\  
      168 if (l->textStart() && (l->textLen() > 0 || l->insertSpace()))\  
    168 168 al.insert(al.end(), new CActText(l->textStart(), l->textLen(), l->insertSpace()));\  
    169 169 }  
     
    1717 1717         CheckForAtom(l);  
    1718 1718         total = l->atom()->identifier();  
    1719           RequireAtom(l);  
    1720           evaluate = l->atom()->identifier();  
      1719         l = lex.getLexem();  
      1720         if (l->res() != CMS_LEX_END_STATEMENT)  
      1721         {  
      1722             evaluate = l->atom()->identifier();  
      1723         }  
    1721 1724     }  
    1722 1725     int res;  
     
    1809 1812 inline int CParser::HSelect(CActionList& al, int lv, int sublv)  
    1810 1813 {  
    1811       string male_name, female_name;  
    1812       bool checked = false;  
      1814     string coMaleName, coFemaleName, coClass;  
      1815     bool bChecked = false, bMultipleSelection = true;  
      1816     int nSize = 3;  
    1813 1817     const CLexem *l;  
    1814 1818     RequireAtom(l);  
     
    1828 1832             FatalPError(parse_err, PERR_WRONG_STATEMENT, MODE_PARSE,  
    1829 1833                         SelectStatements(sublv), lex.prevLine(), lex.prevColumn());  
      1834         l = lex.getLexem();  
      1835         while (l->res() == CMS_LEX_IDENTIFIER)  
      1836         {  
      1837             CheckForAtom(l);  
      1838             string coOption = l->atom()->identifier();  
      1839             l = lex.getLexem();  
      1840             if (l->res() != CMS_LEX_IDENTIFIER)  
      1841             {  
      1842                 string coRequired = case_comp(attr->identifier(), "languages") == 0 ?  
      1843                         "class, size, type" : "class";  
      1844                 SetPError(parse_err, PERR_IDENTIFIER_MISSING, MODE_PARSE, coRequired,  
      1845                           lex.prevLine(), lex.prevColumn());  
      1846                 break;  
      1847             }  
      1848             CheckForAtom(l);  
      1849             if (case_comp(attr->identifier(), "languages") != 0  
      1850                          && case_comp(coOption, "class") != 0)  
      1851             {  
      1852                 SetPError(parse_err, PERR_INVALID_ATTRIBUTE, MODE_PARSE, "class",  
      1853                           lex.prevLine(), lex.prevColumn());  
      1854                 break;  
      1855             }  
      1856             if (case_comp(coOption, "class") == 0)  
      1857             {  
      1858                 coClass = l->atom()->identifier();  
      1859             }  
      1860             if (case_comp(coOption, "size") == 0)  
      1861             {  
      1862                 try  
      1863                 {  
      1864                     nSize = (long int)Integer(l->atom()->identifier());  
      1865                 }  
      1866                 catch (InvalidValue& rcoEx)  
      1867                 {  
      1868                     SetPError(parse_err, PERR_DATA_TYPE, MODE_PARSE, "integer",  
      1869                               lex.prevLine(), lex.prevColumn());  
      1870                     break;  
      1871                 }  
      1872             }  
      1873             if (case_comp(coOption, "type") == 0)  
      1874             {  
      1875                 if (case_comp(l->atom()->identifier(), "single") == 0)  
      1876                 {  
      1877                     bMultipleSelection = false;  
      1878                 }  
      1879                 else if (case_comp(l->atom()->identifier(), "multiple") == 0)  
      1880                 {  
      1881                     bMultipleSelection = true;  
      1882                 }  
      1883                 else  
      1884                 {  
      1885                     SetPError(parse_err, PERR_INVALID_VALUE, MODE_PARSE, "single/multiple",  
      1886                               lex.prevLine(), lex.prevColumn());  
      1887                     break;  
      1888                 }  
      1889             }  
      1890             l = lex.getLexem();  
      1891         }  
    1830 1892     }  
    1831 1893     else if (st->id() == CMS_ST_USER)  
     
    1837 1899         {  
    1838 1900             RequireAtom(l);  
    1839               male_name = l->atom()->identifier();  
      1901             coMaleName = l->atom()->identifier();  
    1839 1901             RequireAtom(l);  
    1840               female_name = l->atom()->identifier();  
      1902             coFemaleName = l->atom()->identifier();  
    1840 1902         }  
    1841 1903         else if (case_comp(attr->identifier(), "Pref", 4) == 0)  
     
    1849 1911                 CheckForAtom(l);  
    1850 1912                 if (case_comp(l->atom()->identifier(), "checked") == 0)  
    1851                       checked = true;  
      1913                     bChecked = true;  
    1851 1913             }  
    1852 1914         }  
    1865 1927                         SelectStatements(sublv), lex.prevLine(), lex.prevColumn());  
    1866 1928     }  
    1867       CActSelect* select = new CActSelect(st->id(), attr->attribute(), male_name, female_name, checked);  
      1929     CActSelect* select = new CActSelect(st->id(), attr->attribute(), coMaleName, coFemaleName,  
      1930                                         bChecked, coClass, nSize, bMultipleSelection);  
    1868 1931     al.insert(al.end(), select);  
    1869 1932     if (l->res() != CMS_LEX_END_STATEMENT)  
  • trunk/campsite/implementation/parser/parser/context.cpp

    r4392 r4460  
    85 85     by_publication = false;  
    86 86     subs_res = -1;  
      87     nSubsTimeUnits = 0;  
    87 88     adduser = modifyuser = login = search = search_and = false;  
    88 89     adduser_res = modifyuser_res = login_res = search_res = -1;  
     
    141 142             && by_publication == c.by_publication  
    142 143             && subs_res == c.subs_res  
      144             && nSubsTimeUnits == c.nSubsTimeUnits  
    143 145             && adduser == c.adduser  
    144 146             && modifyuser == c.modifyuser  
     
    222 224     by_publication = s.by_publication;  
    223 225     subs_res = s.subs_res;  
      226     nSubsTimeUnits = s.nSubsTimeUnits;  
    224 227     adduser = s.adduser;  
    225 228     adduser_res = s.adduser_res;  
     
    456 459  
    457 460 // SetSubs: set subscription for current user  
    458   //      id_type p - publication identifier  
    459   //      id_type s - section identifier  
    460   void CContext::SetSubs(id_type p, id_type s)  
    461   {  
    462       LInt2LIntSet::iterator p_i;  
    463       p_i = subs.find(p);  
    464       if (p_i == subs.end())  
    465           subs.insert(LInt2LIntSet::value_type(p, LIntSet()));  
    466       p_i = subs.find(p);  
    467       if (p_i == subs.end())  
      461 //      id_type p_nPublicationId - publication identifier  
      462 //      id_type p_nSectionNumber - section identifier  
      463 //      id_type p_nLanguageId - language identifier  
      464 void CContext::SetSubs(id_type p_nPublicationId, id_type p_nSectionNumber, id_type p_nLanguageId)  
      465 {  
      466     LInt2LIntMultiMap::iterator coPubIt = subs.find(p_nPublicationId);  
      467     if (coPubIt == subs.end())  
      468     {  
      469         subs.insert(LInt2LIntMultiMap::value_type(p_nPublicationId, LIntMultiMap()));  
      470         coPubIt = subs.find(p_nPublicationId);  
      471     }  
      472     if (coPubIt == subs.end())  
      473     {  
    468 474         return ;  
    469       (*p_i).second.insert(s);  
      475     }  
      476     pair<LIntMultiMap::iterator, LIntMultiMap::iterator> coSectionRange;  
      477     coSectionRange = (*coPubIt).second.equal_range(p_nSectionNumber);  
      478     LIntMultiMap::iterator coSectionIt = coSectionRange.first;  
      479     for (; coSectionIt != coSectionRange.second; ++coSectionIt)  
      480     {  
      481         if ((*coSectionIt).second == p_nLanguageId)  
      482         {  
      483             return;  
      484         }  
      485     }  
      486     (*coPubIt).second.insert(pair<lint, lint>(p_nSectionNumber, p_nLanguageId));  
    470 487 }  
    471 488  
     
    716 733 // IsSubs: return true if the subscription to given publication/section exists  
    717 734 // Parameters:  
    718   //      id_type publication_id - publication identifier  
    719   //      id_type section_id - section identifier  
    720   bool CContext::IsSubs(id_type publication_id, id_type section_id)  
      735 //      id_type p_nPublicationId - publication identifier  
      736 //      id_type p_nSectionId - section identifier  
      737 //      id_type p_nLanguageId - language identifier  
      738 bool CContext::IsSubs(id_type p_nPublicationId, id_type p_nSectionNumber, id_type p_nLanguageId) const  
    721 739 {  
    722       LInt2LIntSet::iterator p_i = subs.find(publication_id);  
    723       if (p_i == subs.end())  
      740     LInt2LIntMultiMap::const_iterator coPubIt = subs.find(p_nPublicationId);  
      741     if (coPubIt == subs.end())  
      742     {  
    724 743         return false;  
    725       return ((*p_i).second.find(section_id) != (*p_i).second.end());  
      744     }  
      745     pair<LIntMultiMap::const_iterator, LIntMultiMap::const_iterator> coSectionRange;  
      746     coSectionRange = (*coPubIt).second.equal_range(p_nSectionNumber);  
      747     LIntMultiMap::const_iterator coSectionIt = coSectionRange.first;  
      748     for (; coSectionIt != coSectionRange.second; ++coSectionIt)  
      749     {  
      750         if ((*coSectionIt).second == p_nLanguageId || (*coSectionIt).second == 0)  
      751         {  
      752             return true;  
      753         }  
      754     }  
      755     return false;  
    726 756 }  
    727 757  
    895 925 void CContext::PrintSubs()  
    896 926 {  
    897       for (LInt2LIntSet::iterator p_i = subs.begin(); p_i != subs.end(); ++p_i)  
      927     for (LInt2LIntMultiMap::iterator p_i = subs.begin(); p_i != subs.end(); ++p_i)  
    897 927     {  
    898           cout << "<p>publication: " << (*p_i).first << "\n<blockquote>";  
    899           LIntSet::iterator s_i;  
      928         cout << "publication: " << (*p_i).first << endl;  
      929         LIntMultiMap::iterator s_i;  
    900 930         for (s_i = (*p_i).second.begin(); s_i != (*p_i).second.end(); ++s_i)  
    901               cout << "<p>section: " << *s_i << "\n";  
    902           cout << "</blockquote>\n";  
      931             cout << "\tsection: " << (*s_i).first << " language: " << (*s_i).second << endl;  
      932         cout << endl;  
    903 933     }  
    904 934 }  
  • trunk/campsite/implementation/parser/parser/process_req.cpp

    r4376 r4460  
    387 387 #endif  
    388 388         p->writeOutput(*pcoCtx, p_rOs);  
      389         p->printParseErrors(cout, true);  
    389 390         if (bPreview == true)  
    390 391         {  
     
    640 641 }  
    641 642  
      643  
    642 644 // ModifyUser: perform modify user action (modify user information in the database)  
    643 645 // Return error code.  
     
    701 703 }  
    702 704  
      705  
      706 typedef multimap<id_type, lint, less<id_type> > SubscriptionSections;  
      707  
      708 int CreateSubscriptionSections(CContext& c, MYSQL* pSql, id_type p_nSubscriptionId,  
      709                                lint p_nLanguageId, bool p_bByPublication, double p_nUnitCost,  
      710                                int p_nSubscriptionTime, const string& p_rcoTimeUnit,  
      711                                const string& p_rcoCurrency,  
      712                                const SubscriptionSections& p_rcoSections)  
      713 {  
      714     char pchBuf[1000];  
      715     double nToPay = 0;  
      716     // create subscription sections  
      717     for (SubscriptionSections::const_iterator coIt = p_rcoSections.begin();  
      718             coIt != p_rcoSections.end(); ++coIt)  
      719     {  
      720         id_type nSection = (*coIt).first;  
      721         lint nTimeUnits = (*coIt).second;  
      722          
      723         // compute the subscription length in days  
      724         sprintf(pchBuf, "select TO_DAYS(ADDDATE(now(), INTERVAL %ld %s)) - TO_DAYS(now())",  
      725                 nTimeUnits, p_rcoTimeUnit.c_str());  
      726         SQLQuery(pSql, pchBuf);  
      727         StoreResult(pSql, coSqlRes);  
      728         CheckForRows(*coSqlRes, 1);  
      729         FetchRow(*coSqlRes, row);  
      730         lint nSubsSectionDays = atol(row[0]);  
      731         lint nPaidDays = c.SubsType() == ST_TRIAL ? nSubsSectionDays : 0;  
      732          
      733         // compute the subscription payment  
      734         if (c.SubsType() == ST_PAID)  
      735         {  
      736             nToPay += (double)nTimeUnits * p_nUnitCost;  
      737         }  
      738  
      739         // check if the subscription section already existed  
      740         sprintf(pchBuf, "select TO_DAYS(ADDDATE(StartDate, INTERVAL Days DAY)) - TO_DAYS(now()) "  
      741                 "from SubsSections where IdSubscription = %ld and SectionNumber = %ld "  
      742                 "and IdLanguage = %ld", p_nSubscriptionId, nSection, p_nLanguageId);  
      743         SQLQuery(pSql, pchBuf);  
      744         coSqlRes = mysql_store_result(pSql);  
      745         if ((row = mysql_fetch_row(*coSqlRes)) != NULL) // yes, update subscription  
      746         {  
      747             if (atol(row[0]) > 0)  
      748                 sprintf(pchBuf, "update SubsSections set Days = Days + %ld, PaidDays = "  
      749                         "PaidDays + %ld where IdSubscription = %ld and SectionNumber = %ld "  
      750                                 "and IdLanguage = %ld",  
      751                         nSubsSectionDays, nPaidDays, p_nSubscriptionId, nSection, p_nLanguageId);  
      752             else  
      753                 sprintf(pchBuf, "update SubsSections set StartDate = now(), Days = %ld, "  
      754                         "PaidDays = %ld where IdSubscription = %ld and SectionNumber = %ld "  
      755                                 "and IdLanguage = %ld",  
      756                         nSubsSectionDays, nPaidDays, p_nSubscriptionId, nSection, p_nLanguageId);  
      757         }  
      758         else // no, create subscription to section  
      759         {  
      760             sprintf(pchBuf, "insert into SubsSections (IdSubscription, SectionNumber, IdLanguage,"  
      761                     " StartDate, Days, PaidDays) values(%ld, %ld, %ld, now(), %ld, %ld)",  
      762                     p_nSubscriptionId, nSection, p_nLanguageId, nSubsSectionDays, nPaidDays);  
      763         }  
      764         SQLQuery(pSql, pchBuf);  
      765     }  
      766      
      767     // set the subscription currency and payment amount  
      768     sprintf(pchBuf, "update Subscriptions set ToPay = ToPay + %f, Currency = '%s' "  
      769             "where Id = %ld", nToPay, p_rcoCurrency.c_str(), p_nSubscriptionId);  
      770     SQLQuery(pSql, pchBuf);  
      771      
      772     return 0;  
      773 }  
      774  
      775  
    703 776 // DoSubscribe: perform subscribe action (subscribe user to a certain publication)  
    704 777 // Parameters:  
     
    717 790     if (c.Publication() < 0)  
    718 791         return SERR_PUBL_NOT_SPECIFIED;  
    719       string s;  
    720       sprintf(pchBuf, "select TimeUnit, PayTime, UnitCost, Currency from Publications where "  
    721               "Id = %ld", c.Publication());  
      792      
      793     // see if subscription is to all languages or only to selected ones  
      794     bool bAllLanguages = case_comp(c.URL()->getValue("subs_all_languages"), "on") == 0;  
      795      
      796     // read time unit, cost, currency  
      797     sprintf(pchBuf, "select TimeUnit, UnitCost, UnitCostAllLang, Currency from Publications "  
      798             "where Id = %ld", c.Publication());  
    722 799     SQLQuery(pSql, pchBuf);  
    723 800     StoreResult(pSql, coSqlRes);  
    724 801     CheckForRows(*coSqlRes, 1);  
    725 802     FetchRow(*coSqlRes, row);  
    726       const char* modifier = "";  
    727       if (row[0][0] == 'D')  
    728           modifier = "DAY";  
    729       else if (row[0][0] == 'W')  
    730           modifier = "WEEK";  
    731       else if (row[0][0] == 'M')  
    732           modifier = "MONTH";  
    733       else if (row[0][0] == 'Y')  
    734           modifier = "YEAR";  
    735       else  
    736           return SERR_UNIT_NOT_SPECIFIED;  
    737       lint paid_time = atol(row[1]);  
    738       double unit_cost = atof(row[2]);  
    739       string currency = row[3];  
    740       id_type id_subscription;  
    741       bool active = true;  
    742       my_ulonglong rows = 0;  
      803     string coTimeUnit = "";  
      804     switch (row[0][0]) {  
      805         case 'D':  
      806             coTimeUnit = "DAY"; break;  
      807         case 'W':  
      808             coTimeUnit = "WEEK"; break;  
      809         case 'M':  
      810             coTimeUnit = "MONTH"; break;  
      811         case 'Y':  
      812             coTimeUnit = "YEAR"; break;  
      813         default:  
      814             return SERR_UNIT_NOT_SPECIFIED;  
      815     }  
      816     double nUnitCost = bAllLanguages ? atof(row[2]) : atof(row[1]);  
      817     string coCurrency = row[3];  
      818      
      819     // create the subscription; check if the subscription already existed  
      820     id_type nSubscriptionId;  
    743 821     sprintf(pchBuf, "select Id, Active, ToPay from Subscriptions where IdUser = %ld and "  
    744               "IdPublication = %ld", c.User(), c.Publication());             "IdPublication = %ld", c.User(), c.Publication());  
      822             "IdPublication = %ld", c.User(), c.Publication());             "IdPublication = %ld", c.User(), c.Publication());  
    744 822     SQLQuery(pSql, pchBuf);  
    745 823     coSqlRes = mysql_store_result(pSql);  
    746       char subs_type = c.SubsType() == ST_TRIAL ? 'T' : 'P';  
    747       if (mysql_num_rows(*coSqlRes) > 0)  
      824     char chSubsType = c.SubsType() == ST_TRIAL ? 'T' : 'P';  
      825     if ((row = mysql_fetch_row(*coSqlRes)) != NULL) // subscription already existed; update it  
    748 826     {  
    749           row = mysql_fetch_row(*coSqlRes);  
    750           id_subscription = atol(row[0]);  
    751           active = row[1][0] == 'Y';  
    752 827         if (atof(row[2]) > 0)  
      828         {  
    753 829             return SERR_SUBS_NOT_PAID;  
    754           if (!active)  
      830         }  
      831         nSubscriptionId = atol(row[0]);  
      832         if (row[1][0] != 'Y')  
    755 833         {  
    756               sprintf(pchBuf, "update Subscriptions set Active = 'Y', Type = '%c' were IdUser"  
    757                       " = %ld and IdPublication = %ld", subs_type, c.User(), c.Publication());  
      834             sprintf(pchBuf, "update Subscriptions set Active = 'Y', Type = '%c' where "  
      835                     "IdUser = %ld and IdPublication = %ld", chSubsType, c.User(), c.Publication());  
    758 836             SQLQuery(pSql, pchBuf);  
    759 837         }  
    760 838     }  
    761       else  
      839     else    // create the subscription  
    761 839     {  
    762 840         sprintf(pchBuf, "insert into Subscriptions (IdUser, IdPublication, Active, Type) "  
    763                   "values(%ld, %ld, 'Y', '%c')", c.User(), c.Publication(), subs_type);  
      841                 "values(%ld, %ld, 'Y', '%c')", c.User(), c.Publication(), chSubsType);  
    763 841         SQLQuery(pSql, pchBuf);  
    764 842         sprintf(pchBuf, "select Id from Subscriptions where IdUser = %ld and "  
    765                   "IdPublication = %ld", c.User(), c.Publication());                 "IdPublication = %ld", c.User(), c.Publication());  
      843                 "IdPublication = %ld", c.User(), c.Publication());                 "IdPublication = %ld", c.User(), c.Publication());  
    765 843         SQLQuery(pSql, pchBuf);  
    766 844         coSqlRes = mysql_store_result(pSql);  
    767 845         CheckForRows(*coSqlRes, 1);  
    768 846         row = mysql_fetch_row(*coSqlRes);  
    769           id_subscription = atol(row[0]);  
      847         nSubscriptionId = atol(row[0]);  
    769 847     }  
    770       bool by_publication = false;  
    771       double to_pay = 0;  
    772       if ((s = c.URL()->getValue("by")) != "" && strcasecmp(s.c_str(), "publication") == 0)  
    773       {  
    774           c.URL()->deleteParameter("by");  
    775           c.DefURL()->deleteParameter("by");  
    776           by_publication = true;  
    777           sprintf(pchBuf, "select Number from Issues where IdPublication = %ld and "  
    778                   "Published = 'Y' and IdLanguage = %ld order by Number DESC limit 0, 1",  
    779                   c.Publication(), c.Language());  
    780           SQLQuery(pSql, pchBuf);  
    781           coSqlRes = mysql_store_result(pSql);  
    782           CheckForRows(*coSqlRes, 1);  
    783           row = mysql_fetch_row(*coSqlRes);  
    784           c.SetIssue(atol(row[0]));  
    785           const char* sel_time = c.SubsType() == ST_TRIAL ? "TrialTime" : "PaidTime";  
    786           sprintf(pchBuf, "select TO_DAYS(ADDDATE(now(), INTERVAL %s %s)) - TO_DAYS(now()), %s "  
    787                   "from SubsDefTime, Users where IdPublication = %ld and "  
    788                   "SubsDefTime.CountryCode = Users.CountryCode and Users.Id = %ld",  
    789                   sel_time, modifier, sel_time, c.Publication(), c.User());  
    790           SQLQuery(pSql, pchBuf);  
    791           coSqlRes = mysql_store_result(pSql);  
    792           if (mysql_num_rows(*coSqlRes) < 1) {  
    793               sprintf(pchBuf, "select TO_DAYS(ADDDATE(now(), INTERVAL %s %s)) - TO_DAYS(now()), "  
    794                       "%s from Publications where Id = %ld", sel_time, modifier, sel_time,  
    795                       c.Publication());  
    796               SQLQuery(pSql, pchBuf);  
    797               coSqlRes = mysql_store_result(pSql);  
    798               if (mysql_num_rows(*coSqlRes) < 1)  
    799                   return -1;  
    800           }  
    801           row = mysql_fetch_row(*coSqlRes);  
    802           lint subs_days = atol(row[0]);  
    803           lint time_units = atol(row[1]);  
    804           if (c.SubsType() == ST_TRIAL)  
    805               paid_time = subs_days;  
    806           sprintf(pchBuf, "select Number from Sections where IdPublication = %ld and NrIssue "  
    807                   "= %ld and IdLanguage = %ld", c.Publication(), c.Issue(), c.Language());  
      848      
      849     // Compute the subscription length; search for the default subscription intervals in  
      850     // the countries subscriptions intervals table first  
      851     const char* pchSubsTypeTime = c.SubsType() == ST_TRIAL ? "TrialTime" : "PaidTime";  
      852     sprintf(pchBuf, "select %s from SubsDefTime, Users where IdPublication = %ld and "  
      853             "SubsDefTime.CountryCode = Users.CountryCode and Users.Id = %ld",  
      854             pchSubsTypeTime, c.Publication(), c.User());  
      855     SQLQuery(pSql, pchBuf);  
      856     coSqlRes = mysql_store_result(pSql);  
      857      
      858     // If the default subscription interval was not found in the countries subscriptions  
      859     // intervals table read it from the publications table  
      860     if (mysql_num_rows(*coSqlRes) < 1)  
      861     {  
      862         sprintf(pchBuf, "select %s from Publications where Id = %ld", pchSubsTypeTime,  
      863                 c.Publication());  
    808 864         SQLQuery(pSql, pchBuf);  
    809 865         coSqlRes = mysql_store_result(pSql);  
    810 866         CheckForRows(*coSqlRes, 1);  
    811           while ((row = mysql_fetch_row(*coSqlRes)) != NULL)  
    812           {  
    813               sprintf(pchBuf, "replace into SubsSections set IdSubscription = %ld, "  
    814                       "SectionNumber = %s, StartDate = now(), Days = %ld, PaidDays = %ld",  
    815                        id_subscription, row[0], subs_days, paid_time);  
    816               SQLQuery(pSql, pchBuf);  
    817               to_pay += unit_cost * time_units;  
    818           }  
    819 867     }  
    820       if ((s = c.URL()->getValue(P_CB_SUBS)) != "" && !by_publication)  
    821       {  
    822           while (s != "")  
      868     row = mysql_fetch_row(*coSqlRes);  
      869     lint nSubscriptionTime = atol(row[0]);  
      870     c.SetSubsTimeUnits(nSubscriptionTime);  
      871      
      872     // read the subscription mode: by publication or by section  
      873     string coValue;  
      874     bool bByPublication = (coValue = c.URL()->getValue("by")) != ""  
      875             && strcasecmp(coValue.c_str(), "publication") == 0;  
      876     c.URL()->deleteParameter("by");  
      877     c.DefURL()->deleteParameter("by");  
      878      
      879     // initialise the list of subscription sections  
      880     SubscriptionSections coSubscriptionSections;  
      881      
      882     // subscribe mode: by section  
      883     // read the list of sections from the parameters list  
      884     coValue = c.URL()->getValue(P_CB_SUBS);  
      885     while (!bByPublication && coValue != "")  
      886     {  
      887         id_type nSection = atol(coValue.c_str());  
      888         sprintf(pchBuf, "%s%ld", P_TX_SUBS, nSection);  
      889         lint nTimeUnits = nSubscriptionTime;  
      890         if ((coValue = c.URL()->getValue(pchBuf)) != "")  
      891         {  
      892             nTimeUnits = atol(coValue.c_str());  
      893              
      894             // delete parameters we don't need anymore  
      895             c.URL()->deleteParameter(pchBuf);  
      896             c.DefURL()->deleteParameter(pchBuf);  
      897         }  
      898         coSubscriptionSections.insert(pair<id_type, lint>(nSection, nTimeUnits));  
      899         coValue = c.URL()->getNextValue(P_CB_SUBS);  
      900     }  
      901     // delete parameters we don't need anymore  
      902     c.URL()->deleteParameter(P_CB_SUBS);  
      903     c.DefURL()->deleteParameter(P_CB_SUBS);  
      904      
      905     // initialize the language list  
      906     list<id_type> coLanguages;  
      907     coValue = c.URL()->getValue("subscription_language");  
      908     while (!bAllLanguages && coValue != "")  
      909     {  
      910         coLanguages.push_back(atol(coValue.c_str()));  
      911         coValue = c.URL()->getNextValue("subscription_language");  
      912     }  
      913     c.URL()->deleteParameter("subscription_language");  
      914     c.DefURL()->deleteParameter("subscription_language");  
      915     if (coLanguages.empty())  
      916     {  
      917         coLanguages.push_back(bAllLanguages ? 0 : c.Language());  
      918     }  
      919      
      920     // run the CreateSubscriptionSections function for each language  
      921     for (list<id_type>::iterator coIt = coLanguages.begin(); coIt != coLanguages.end(); ++coIt)  
      922     {  
      923         // subscribe mode: by publication  
      924         // create the list of subscription sections for the current language  
      925         if (bByPublication)  
    823 926         {  
    824               id_type section = atol(s.c_str());  
    825               sprintf(pchBuf, "%s%s", P_TX_SUBS, s.c_str());  
    826               if ((s = c.URL()->getValue(pchBuf)) == "")  
      927             if (*coIt == 0)  
    827 928             {  
    828                   s = c.URL()->getNextValue(P_CB_SUBS);  
    829                   continue;  
      929                 sprintf(pchBuf, "select Number from Sections where IdPublication = %ld "  
      930                         "group by Number", c.Publication());  
    830 931             }  
    831               lint time_units = atol(s.c_str());  
    832               sprintf(pchBuf, "select TO_DAYS(ADDDATE(now(), INTERVAL %ld %s)) - TO_DAYS(now())",  
    833                       time_units, modifier);  
    834               SQLQuery(pSql, pchBuf);  
    835               coSqlRes = mysql_store_result(pSql);  
    836               CheckForRows(*coSqlRes, 1);  
    837               row = mysql_fetch_row(*coSqlRes);  
    838               lint req_days = atol(row[0]);  
    839               if (c.SubsType() == ST_TRIAL)  
    840                   paid_time = req_days;  
    841               sprintf(pchBuf, "select TO_DAYS(ADDDATE(StartDate, INTERVAL Days DAY)) - "  
    842                       "TO_DAYS(now()) from SubsSections where IdSubscription = %ld and "  
    843                       "SectionNumber = %ld", id_subscription, section);  
    844               SQLQuery(pSql, pchBuf);  
    845               coSqlRes = mysql_store_result(pSql);  
    846               to_pay += unit_cost * time_units;  
    847               if ((rows = mysql_num_rows(*coSqlRes)))  
      932             else  
    848 933             {  
    849                   row = mysql_fetch_row(*coSqlRes);  
    850                   if (c.SubsType() == ST_TRIAL)  
    851                       paid_time = req_days;  
    852                   if (atol(row[0]) > 0)  
    853                       sprintf(pchBuf, "update SubsSections set Days = Days + %ld, PaidDays = "  
    854                               "PaidDays + %ld where IdSubscription = %ld and SectionNumber = %ld",  
    855                               req_days, paid_time, id_subscription, section);  
    856                   else  
    857                       sprintf(pchBuf, "update SubsSections set StartDate = now(), Days = %ld, "  
    858                               "PaidDays = %ld where IdSubscription = %ld and SectionNumber = %ld",  
    859                               req_days, paid_time, id_subscription, section);  
      934                 sprintf(pchBuf, "select Number from Sections where IdPublication = %ld "  
      935                         "and IdLanguage = %ld group by Number", c.Publication(), *coIt);  
    860 936             }  
    861               else  
    862                   sprintf(pchBuf, "insert into SubsSections (IdSubscription, SectionNumber, "  
    863                           "StartDate, Days, PaidDays) values(%ld, %ld, now(), %ld, %ld)",  
    864                           id_subscription, section, req_days, paid_time);  
    865 937             SQLQuery(pSql, pchBuf);  
    866               s = c.URL()->getNextValue(P_CB_SUBS);  
      938             StoreResult(pSql, coSqlRes);  
      939             MYSQL_ROW row;  
      940             coSubscriptionSections.clear();  
      941             while ((row = mysql_fetch_row(*coSqlRes)) != NULL)  
      942             {  
      943                 coSubscriptionSections.insert(pair<id_type, lint>(atol(row[0]),  
      944                                               nSubscriptionTime));  
      945             }  
      946         }  
      947      
      948         int res = CreateSubscriptionSections(c, pSql, nSubscriptionId, *coIt, bByPublication,  
      949                                              nUnitCost, nSubscriptionTime, coTimeUnit,  
      950                                              coCurrency, coSubscriptionSections);  
      951         if (res != 0)  
      952         {  
      953             return res;  
    867 954         }  
    868           c.URL()->deleteParameter(P_CB_SUBS);  
    869           c.DefURL()->deleteParameter(P_CB_SUBS);  
    870       }  
    871       if (c.SubsType() != ST_TRIAL)  
    872       {  
    873           sprintf(pchBuf, "update Subscriptions set ToPay = ToPay + %f, Currency = '%s' "  
    874                   "where Id = %ld", to_pay, currency.c_str(), id_subscription);  
    875           SQLQuery(pSql, pchBuf);  
    876 955     }  
    877 956     return 0;  
    878 957 }  
    879 958  
      959  
    880 960 // SetReaderAccess: update current context: set reader access to publication sections  
    881 961 // according to user subscriptions.  
     
    905 985         id_type id_publ = atol(row[0]), id_subs = atol(row[1]);  
    906 986         sprintf(pchBuf, "select SectionNumber, (TO_DAYS(now())-TO_DAYS(StartDate)), "  
    907                   "PaidDays from SubsSections where IdSubscription = %ld", id_subs);  
      987                 "PaidDays, IdLanguage from SubsSections where IdSubscription = %ld", id_subs);  
    907 987         if (mysql_query(pSql, pchBuf))  
    908 988             continue;  
    917 997             lint passed_days = atol(row2[1]);  
    918 998             lint days = atol(row2[2]);  
      999             lint languageId = atol(row2[3]);  
    919 1000             if (passed_days <= days)  
    920                   c.SetSubs(id_publ, nr_section);  
      1001                 c.SetSubs(id_publ, nr_section, languageId);  
    920 1001         }  
    921 1002         mysql_free_result(res2);  
  • trunk/campsite/implementation/parser/parser/lex.cpp

    r4406 r4460  
    568 568     pcoCtx->insertAttr(new CIntegerAttr("trialtime"));  
    569 569     pcoCtx->insertAttr(new CIntegerAttr("paidtime"));  
    570       pcoCtx->insertAttr(new CIntegerAttr("totalcost"));  
    571 570     pcoSt->insertCtx(pcoCtx);  
    572 571  
     
    577 576     pcoCtx = new CStatementContext(CMS_CT_SELECT);  
    578 577     pcoCtx->insertAttr(new CAttribute("section"));  
      578     pcoCtx->insertAttr(new CAttribute("languages"));  
      579     pcoCtx->insertAttr(new CAttribute("alllanguages"));  
    579 580     pcoSt->insertCtx(pcoCtx);  
    580 581  
    1028 1029                     m_coLexem.setInsertSpace(bInsertSpace);  
    1029 1030                 }  
      1031                 if (!(m_pchTextStart && bValidText) && bInsertSpace)  
      1032                 {  
      1033                     m_coLexem.setTextStart(m_pchInBuf + m_nIndex);  
      1034                     m_coLexem.setTextLen(0);  
      1035                     m_coLexem.setInsertSpace(true);  
      1036                 }  
    1030 1037                 m_coLexem.setRes(CMS_LEX_START_STATEMENT);  
    1031 1038                 return &m_coLexem;  
  • trunk/campsite/implementation/parser/parser/actions.cpp

    r4436 r4460  
    1575 1575     if (modifier == CMS_ST_SUBSCRIPTION)  
    1576 1576     {  
    1577           if (case_comp(attr, "totalcost") == 0)  
    1578           {  
    1579               if (c.SubsType() == ST_NONE)  
    1580                   return RES_OK;  
    1581               const char* subs = c.SubsType() == ST_TRIAL ? "TrialTime" : "PaidTime";  
    1582               buf << "select sum(UnitCost) * sdt." << subs << " from Sections as sec, Publications"  
    1583                      " as pub, SubsDefTime as sdt where pub.Id = sdt.IdPublication and pub.Id = "  
    1584                      "sec.IdPublication and sdt.IdPublication = pub.Id and pub.Id = "  
    1585                   << c.Publication() << " and NrIssue = " << c.Issue() << " and IdLanguage = "  
    1586                   << c.Language() << " and CountryCode = '" << c.UserInfo("CountryCode") << "'";  
    1587               DEBUGAct("takeAction()", buf.str().c_str(), fs);  
    1588               SQLQuery(&m_coSql, buf.str().c_str());  
    1589               res = mysql_store_result(&m_coSql);  
    1590               row = mysql_fetch_row(*res);  
    1591               if (row[0] == NULL || row[0][0] == 0)  
    1592               {  
    1593                   buf.str("");  
    1594                   buf << "select sum(UnitCost) * " << subs << " from Sections, Publications as pub"  
    1595                          " where pub.Id = Sections.IdPublication and pub.Id = "  
    1596                       << c.Publication() << " and NrIssue = " << c.Issue() << " and IdLanguage = "  
    1597                       << c.Language();  
    1598                   DEBUGAct("takeAction()", buf.str().c_str(), fs);  
    1599                   SQLQuery(&m_coSql, buf.str().c_str());  
    1600                   res = mysql_store_result(&m_coSql);  
    1601                   row = mysql_fetch_row(*res);  
    1602                   if (row[0] == NULL || row[0][0] == 0)  
    1603                       return -1;  
    1604               }  
    1605               fs << encodeHTML(row[0], c.EncodeHTML());  
    1606               return RES_OK;  
    1607           }  
    1608 1577         if (case_comp(attr, "unit") == 0)  
    1609 1578         {  
     
    2054 2023     buf << "select Public from Articles where IdPublication = " << c.Publication() << " and "  
    2055 2024            "NrIssue = " << c.Issue() << " and NrSection = " << c.Section() << " and Number = "  
    2056           << c.Article() << " and (IdLanguage = " << c.Language() << " or IdLanguage = 1) order "  
    2057              "by IdLanguage desc";  
      2025         << c.Article() << " and IdLanguage = " << c.Language();  
    2058 2026     DEBUGAct("AccessAllowed()", buf.str().c_str(), fs);  
    2059 2027     if (mysql_query(&m_coSql, buf.str().c_str()))  
     
    2074 2042     if (!c.IsReader())  
    2075 2043         return true;  
    2076       return c.IsSubs(c.Publication(), c.Section());  
      2044     return c.IsSubs(c.Publication(), c.Section(), c.Language());  
    2076 2044 }  
    2077 2045  
     
    2683 2651 // Parametes:  
    2684 2652 //      CContext& c - current context  
      2653 //      sockstream& fs - output stream  
      2654 int CActText::takeAction(CContext& c, sockstream& fs)  
      2655 {  
      2656     if (m_bInsertSpace)  
      2657     {  
      2658         fs << ' ';  
      2659     }  
      2660     fs.write(text, text_len);  
      2661     return RES_OK;  
      2662 }  
      2663  
      2664 // takeAction: performs the action  
      2665 // Parametes:  
      2666 //      CContext& c - current context  
    2685 2667 //      sockstream& fs - output stream   
    2686 2668 int CActSubscription::takeAction(CContext& c, sockstream& fs)  
     
    2698 2680         FetchRow(*res, row);  
    2699 2681         if (row[0] == NULL || row[1] == NULL)  
      2682         {  
    2700 2683             return -1;  
    2701           if (row[0][0] == 'T')  
    2702               c.SetSubsType(ST_TRIAL);  
    2703           else  
    2704               c.SetSubsType(ST_PAID);  
      2684         }  
      2685         c.SetSubsType((row[0][0] == 'T') ? ST_TRIAL : ST_PAID);  
    2705 2686         c.SetUserInfo("CountryCode", row[1]);  
    2706 2687         buf.str("");  
    2707 2688     }  
    2708       buf << "select UnitCost, Currency from Publications where Id = " << c.Publication();  
      2689      
      2690     // Compute the subscription length; search for the default subscription intervals in  
      2691     // the countries subscriptions intervals table first  
      2692     const char* pchSubsTypeTime = c.SubsType() == ST_TRIAL ? "TrialTime" : "PaidTime";  
      2693     buf << "select " << pchSubsTypeTime << " from SubsDefTime, Users where IdPublication = "  
      2694             << c.Publication() << " and SubsDefTime.CountryCode = Users.CountryCode and "  
      2695             "Users.Id = " << c.User();  
    2709 2696     SQLQuery(&m_coSql, buf.str().c_str());  
    2710 2697     StoreResult(&m_coSql, res);  
    2711       CheckForRows(*res, 1);  
    2712       FetchRow(*res, row);  
    2713       if (row[0] == NULL)  
    2714           return -1;  
    2715       double unit_cost = atof(row[0]);  
    2716       string currency = row[1];  
      2698     MYSQL_ROW row;  
      2699     if ((row = mysql_fetch_row(*res)) != NULL)  
      2700     {  
      2701         c.SetSubsTimeUnits(atol(row[0]));  
      2702     }  
    2717 2703     buf.str("");  
    2718       buf << "select count(*) from Sections where IdPublication = " << c.Publication() << " and "  
    2719              "NrIssue = " << c.Issue() << " and IdLanguage = " << c.Language();  
      2704      
      2705     buf << "select Currency, " << pchSubsTypeTime << ", UnitCost, UnitCostAllLang from "  
      2706             "Publications where Id = " << c.Publication();  
    2720 2707     SQLQuery(&m_coSql, buf.str().c_str());  
    2721 2708     res = mysql_store_result(&m_coSql);  
    2722 2709     CheckForRows(*res, 1);  
    2723 2710     row = mysql_fetch_row(*res);  
    2724       if (row[0] == NULL)  
    2725           return -1;  
    2726       lint nos = atol(row[0]);  
      2711     string currency = row[0];  
      2712     // If the default subscription interval was not found in the countries subscriptions  
      2713     // intervals table read it from the publications table  
      2714     if (c.SubsTimeUnits() == 0)  
      2715     {  
      2716         c.SetSubsTimeUnits(atol(row[1]));  
      2717     }  
      2718     double nUnitCost = atof(row[2]);  
      2719     double nUnitCostAllLang = atof(row[3]);  
      2720     buf.str("");  
      2721      
      2722     buf << "select * from Sections where IdPublication = " << c.Publication()  
      2723             << " group by Number";  
      2724     SQLQuery(&m_coSql, buf.str().c_str());  
      2725     res = mysql_store_result(&m_coSql);  
      2726     CheckForRows(*res, 1);  
      2727     lint nos = mysql_num_rows(*res);  
    2727 2728     SafeAutoPtr<CURL> pcoURL(c.URL()->clone());  
    2728 2729     try {  
     
    2736 2737     lc.SetByPublication(by_publication);  
    2737 2738     string coSubsType = (c.SubsType() == ST_TRIAL ? "trial" : "paid");  
    2738       fs << "<form name=\"subscription\" action=\""  
    2739               << encodeHTML(pcoURL->getURIPath(), c.EncodeHTML())  
    2740               << "\" name=\"f1\" method=\"POST\">\n"  
      2739     fs << "<script>\n"  
      2740             "function ToggleElementEnabled(id) {\n"  
      2741             "   if (document.getElementById(id).disabled) {\n"  
      2742             "       document.getElementById(id).disabled = false\n"  
      2743             "   } else {\n"  
      2744             "       document.getElementById(id).disabled = true\n"  
      2745             "   }\n"  
      2746             "}\n"  
      2747             "</script>\n";  
      2748     fs << "<form action=\"" << encodeHTML(pcoURL->getURIPath(), c.EncodeHTML())  
      2749             << "\" name=\"subscription_form\" method=\"POST\">\n"  
    2741 2750             << "<input type=\"hidden\" name=\"" << P_TEMPLATE_ID  
    2742 2751             << "\" value=\"" << m_nTemplateId << "\">\n"  
    2743 2752             << "<input type=\"hidden\" name=\"" << P_SUBSTYPE << "\" value=\""  
    2744               << encodeHTML(coSubsType, c.EncodeHTML()) << "\">" << endl;  
    2745       if (c.SubsType() == ST_PAID && total != "")  
    2746           fs << "<script>\nvar sum;\nvar i;\n\n"  
    2747           "function f(){\n"  
    2748           " sum=0;\n"  
    2749           " for(i=0; i<document.f1.nos.value; i++){\n"  
    2750           "   if(document.f1.cb_subs[i].checked && document.f1[2*i+1].value.length)\n"  
    2751           "   sum=parseInt(sum)+parseInt(document.f1[2*i+1].value)\n"  
    2752           " }\n"  
    2753           " document.f1.suma.value = Math.round(100*sum*document.f1.unitcost.value)/100;\n"  
    2754           "}\n</script>\n";  
      2753             << encodeHTML(coSubsType, c.EncodeHTML()) << "\">\n"  
      2754             << "<input type=\"hidden\" name=\"tx_subs\" value=\"" << c.SubsTimeUnits() << "\">\n"  
      2755             << "<input type=\"hidden\" name=\"nos\" value=\"" << nos << "\">\n"  
      2756             << "<input type=\"hidden\" name=\"unitcost\" value=\"" << nUnitCost << "\">\n"  
      2757             << "<input type=\"hidden\" name=\"unitcostalllang\" value=\""  
      2758             << nUnitCostAllLang << "\">\n";  
    2755 2759     runActions(block, lc, fs);  
    2756       if (c.SubsType() == ST_PAID && total != "" && !by_publication)  
      2760     if (c.SubsType() == ST_PAID && total != "")  
      2761     {  
    2757 2762         fs << encodeHTML(total, c.EncodeHTML())  
    2758 2763                 << " <input type=\"text\" name=\"suma\" size=\"10\" READONLY> "  
    2759 2764                 << encodeHTML(currency, c.EncodeHTML()) << endl;  
      2765     }  
    2760 2766     fs << c.URL()->getFormString();  
    2761       if (c.SubsType() == ST_PAID && total != "" && !by_publication)  
    2762           fs << "<input type=\"hidden\" name=\"unitcost\" value=\"" << unit_cost  
    2763                   << "\">\n<input type=\"hidden\" name=\"nos\" value=\"" << nos << "\">\n"  
    2764                   << "<p><input type=\"button\" value=\""  
    2765                   << encodeHTML(evaluate, c.EncodeHTML()) << "\" onclick=\"f()\"></p>\n";  
      2767     if (c.SubsType() == ST_PAID && evaluate != "")  
      2768     {  
      2769         fs << "<p><input type=\"button\" value=\"" << encodeHTML(evaluate, c.EncodeHTML())  
      2770                 << "\" onclick=\"update_subscription_payment()\"></p>\n";  
      2771     }  
    2766 2772     if (by_publication)  
    2767           fs << "<input type=\"hidden\" name=\"by\" value=\"publication\">\n";  
    2768       fs << "<input type=\"submit\" name=\"" P_SUBSCRIBE "\" value=\""  
    2769               << encodeHTML(button_name, c.EncodeHTML()) << "\">\n</form>\n";  
      2773     {  
      2774         fs << "<input type=\"hidden\" name=\"by\" value=\"publication\">\n"  
      2775                 "<input type=\"hidden\" name=\"cb_subs\" value=\"0\">\n";  
      2776     }  
      2777     fs << "<p><input type=\"submit\" name=\"" P_SUBSCRIBE "\" value=\""  
      2778             << encodeHTML(button_name, c.EncodeHTML()) << "\"></p>\n</form>\n";  
      2779     if (c.SubsType() == ST_PAID && total != "")  
      2780     {  
      2781         fs << "<script>\n"  
      2782                 "function element_exists(object, property) {\n"  
      2783                 "   for (i in object) {\n"  
      2784                 "       if (object[i].name == property) {\n"  
      2785                 "           return true\n"  
      2786                 "       }\n"  
      2787                 "   }\n"  
      2788                 "   return false\n"  
      2789                 "}\n"  
      2790                 "function update_subscription_payment() {\n"  
      2791                 "   var sum = 0\n"  
      2792                 "   var i\n"  
      2793                 "   var my_form = document.forms[\"subscription_form\"]\n"  
      2794                 "   var subs_all_lang = false\n"  
      2795                 "   var unitcost = my_form.unitcost.value\n"  
      2796                 "   var lang_count = 1\n"  
      2797                 "   if (element_exists(my_form.elements, \"subs_all_languages\")\n"  
      2798                 "       && my_form.subs_all_languages.checked) {\n"  
      2799                 "       unitcost = my_form.unitcostalllang.value\n"  
      2800                 "   } else if (element_exists(my_form.elements, \"subscription_language[]\")) {\n"  
      2801                 "       lang_count = 0\n"  
      2802                 "       for (i=0; i<my_form[\"subscription_language[]\"].options.length; i++) {\n"  
      2803                 "           if (my_form[\"subscription_language[]\"].options[i].selected) {\n"  
      2804                 "               lang_count++\n"  
      2805                 "           }\n"  
      2806                 "       }\n"  
      2807                 "   }\n"  
      2808                 "   for (i = 0; i < my_form.nos.value; i++) {\n"  
      2809                 "       if (element_exists(my_form.elements, \"by\")\n"  
      2810                 "           && my_form.by.value == \"publication\") {\n"  
      2811                 "           sum = parseInt(sum) + parseInt(my_form[\"tx_subs\"].value)\n"  
      2812                 "           continue\n"  
      2813                 "       }\n"  
      2814                 "       if (!my_form[\"cb_subs[]\"][i].checked) {\n"  
      2815                 "           continue\n"  
      2816                 "       }\n"  
      2817                 "       var section = my_form[\"cb_subs[]\"][i].value\n"  
      2818                 "       var time_var_name = \"tx_subs\" + section\n"  
      2819                 "       if (element_exists(my_form.elements, time_var_name)) {\n"  
      2820                 "           sum = parseInt(sum) + parseInt(my_form[time_var_name].value)\n"  
      2821                 "       } else if (element_exists(my_form.elements, \"tx_subs\")) {\n"  
      2822                 "           sum = parseInt(sum) + parseInt(my_form[\"tx_subs\"].value)\n"  
      2823                 "       }\n"  
      2824                 "   }\n"  
      2825                 "   my_form.suma.value = Math.round(100 * sum * unitcost * lang_count) / 100\n"  
      2826                 "}\n"  
      2827                 "update_subscription_payment()\n"  
      2828                 "</script>\n";  
      2829     }  
    2770 2830     return RES_OK;  
    2771 2831     TK_CATCH_ERR  
     
    2826 2886     if (modifier == CMS_ST_SUBSCRIPTION)  
    2827 2887     {  
    2828           buf << "select TrialTime, PaidTime from SubsDefTime, Users where "  
    2829                  "SubsDefTime.CountryCode = Users.CountryCode and SubsDefTime."  
    2830                  "IdPublication = " << c.Publication() << " and Users.Id = " << c.User();  
    2831           DEBUGAct("takeAction()", buf.str().c_str(), fs);  
    2832           SQLQuery(&m_coSql, buf.str().c_str());  
    2833           StoreResult(&m_coSql, res);  
    2834           if (mysql_num_rows(*res) < 1)  
    2835           {  
    2836               buf.str("");  
    2837               buf << "select TrialTime, PaidTime from Publications where Id = " << c.Publication();  
    2838               SQLQuery(&m_coSql, buf.str().c_str());  
    2839               res = mysql_store_result(&m_coSql);  
    2840           }  
    2841           FetchRow(*res, row);  
    2842           const char* pchData = c.SubsType() == ST_TRIAL ? row[0] : row[1];  
    2843 2888         fs << "<input type=\"hidden\" name=\"" << P_TX_SUBS << c.Section() << "\" value=\""  
    2844                   << encodeHTML(pchData, c.EncodeHTML()) << "\">"  
    2845                   << encodeHTML(pchData, c.EncodeHTML());  
      2889                 << c.SubsTimeUnits() << "\">" << c.SubsTimeUnits();  
    2846 2890     }  
    2847 2891     if (modifier == CMS_ST_LOGIN)  
    2887 2931     if (modifier == CMS_ST_SUBSCRIPTION)  
    2888 2932     {  
    2889           if (c.ByPublication())  
    2890               fs << "<input type=\"hidden\" name=\"" << P_CB_SUBS << "\" value=\""  
    2891               << c.Section() << "\">";  
    2892           else  
    2893               fs << "<input type=\"checkbox\" name=\"" << P_CB_SUBS << "\" value=\""  
    2894               << c.Section() << "\">";  
      2933         string coClassAttr = m_coClass != "" ? string(" class=\"") + m_coClass + "\"" : "";  
      2934         if (case_comp(field, "Section") == 0)  
      2935         {  
      2936             if (c.ByPublication())  
      2937             {  
      2938                 fs << "<input type=\"hidden\" name=\"" << P_CB_SUBS << "[]\" value=\""  
      2939                         << c.Section() << "\"" << coClassAttr << ">";  
      2940             }  
      2941             else  
      2942             {  
      2943                 fs << "<input type=\"checkbox\" name=\"" << P_CB_SUBS << "[]\" value=\""  
      2944                         << c.Section() << "\" onchange=\"update_subscription_payment()\""  
      2945                         << coClassAttr << ">";  
      2946             }  
      2947         }  
      2948         else if (case_comp(field, "Languages") == 0)  
      2949         {  
      2950             buf << "select l.Id, l.OrigName from Issues as i, Languages as l where "  
      2951                     "i.IdLanguage = l.Id and i.IdPublication = " << c.Publication()  
      2952                     << " group by l.Id";  
      2953             SQLQuery(&m_coSql, buf.str().c_str());  
      2954             StoreResult(&m_coSql, res);  
      2955             fs << "<select name=\"subscription_language[]\"" << coClassAttr << " size=\""  
      2956                     << m_nSize << "\"" << (m_bMultipleSelect ? " multiple" : "")  
      2957                     << " onchange=\"update_subscription_payment()\" id=\"select_language\">\n";  
      2958             MYSQL_ROW row;  
      2959             while ((row = mysql_fetch_row(*res)))  
      2960             {  
      2961                 id_type nLanguageId = atol(row[0]);  
      2962                 fs << "<option value=\"" << nLanguageId << "\""  
      2963                         << (nLanguageId == c.Language() ? " selected" : "") << ">"  
      2964                         << encodeHTML(row[1], c.EncodeHTML()) << "</option>\n";  
      2965             }  
      2966             fs << "</select>\n";  
      2967         }  
      2968         else if (case_comp(field, "AllLanguages") == 0)  
      2969         {  
      2970             fs << "<input type=\"checkbox\" name=\"subs_all_languages\"" << coClassAttr  
      2971                     << " onchange=\"update_subscription_payment(); "  
      2972                     "ToggleElementEnabled('select_language');\">";  
      2973         }  
    2895 2974     }  
    2896 2975     else if (modifier == CMS_ST_USER)  
  • trunk/campsite/implementation/parser/parser/context.h

    r4392 r4460  
    115 115 using std::less;  
    116 116  
    117   typedef set <lint> LIntSet;  
      117 typedef multimap <lint, lint, less <lint> > LIntMultiMap;  
    117 117  
    118   typedef map <lint, LIntSet, less <lint> > LInt2LIntSet;  
      118 typedef map <lint, LIntMultiMap, less <lint> > LInt2LIntMultiMap;  
    118 118  
    119 119 typedef map <string, lint, str_case_less> String2LInt;  
     
    137 137 private:  
    138 138     String2String userinfo;                 // informations about user (name, address, email etc.)  
    139       ulint ip;                       // client IP  
      139     ulint ip;                               // client IP  
    139 139     id_type user_id;                        // user identifier  
    140       ulint key;                      // user key (used for authentication purposes)  
      140     ulint key;                              // user key (used for authentication purposes)  
    140 140     bool is_reader;                         // true if user is reader  
    141 141     bool access_by_ip;                      // true is access is by IP  
     
    153 153     id_type a_list_start, sr_list_start;    // and search lists  
    154 154     String2LInt st_list_start;              // list start index for subtitle list  
    155       lint list_index;                    // current list index  
    156       lint list_row;                      // current list row (table construction)  
    157       lint list_column;                   // current list column  
    158       lint list_length;                   // list length  
    159       lint i_prev_start, i_next_start;    // list start index for issue, section, article,  
    160       lint s_prev_start, s_next_start;    // and search lists in previous and next contexts  
      155     lint list_index;                        // current list index  
      156     lint list_row;                          // current list row (table construction)  
      157     lint list_column;                       // current list column  
      158     lint list_length;                       // list length  
      159     lint i_prev_start, i_next_start;        // list start index for issue, section, article,  
      160     lint s_prev_start, s_next_start;        // and search lists in previous and next contexts  
    161 161     lint a_prev_start, a_next_start;  
    162 162     lint sr_prev_start, sr_next_start;  
    163       String2LInt st_prev_start, st_next_start;// list start index for subtitles list in previous  
    164                                               // and next context  
      163     String2LInt st_prev_start;              // subtitles list start index in the previous context  
      164     String2LInt st_next_start;              // subtitles list start index in the next context  
    165 165     TLMode lmode;                           // list mode (PREV, NORMAL, NEXT)  
    166 166     TStMode stmode;                         // subtitles list mode  
    167       LInt2LIntSet subs;                      // user subscriptions  
      167     LInt2LIntMultiMap subs;                 // user subscriptions  
    167 167     StringSet keywords;                     // keywords to search for  
    168 168     string str_keywords;                    // the string of keywords  
     
    172 172     TSubsType subs_type;                    // subscription type  
    173 173     bool by_publication;                    // subscription by: publication or sections  
    174       lint subs_res;                      // subscription result  
      174     lint subs_res;                          // subscription result  
      175     lint nSubsTimeUnits;                    // default subscription time in the time units  
      176                                             // defined by the publication: days, months etc.  
    175 177     bool adduser;                           // true if add user process occured  
    176 178     bool modifyuser;                        // true if modify user process occured  
    177       lint adduser_res, modifyuser_res;   // add/modify user result  
      179     lint adduser_res, modifyuser_res;       // add/modify user result  
    177 179     bool login;                             // true if login process occured  
    178       lint login_res;                     // login result  
      180     lint login_res;                         // login result  
    178 180     bool search;                            // true if search process occured  
    179       lint search_res;                    // search result  
      181     lint search_res;                        // search result  
    179 181     bool search_and;                        // true if search for all keywords  
    180 182     int search_level;                       // search level: 0 - all, 1 - issue, 2 - section  
     
    343 345         stmode = sm;  
    344 346     }  
    345       void SetSubs(id_type, id_type);  
      347     void SetSubs(id_type p_nPublicationId, id_type p_nSectionNumber, id_type p_nLanguageId);  
    345 347     void SetKeyword(const string& k)  
    346 348     {  
     
    372 374         subs_res = r;  
    373 375     }  
      376     void SetSubsTimeUnits(lint t)  
      377     {  
      378         nSubsTimeUnits = t;  
      379     }  
    374 380     void SetAddUser(bool au)  
    375 381     {  
     
    607 613         return stmode;  
    608 614     }  
    609       bool IsSubs(id_type, id_type);  
      615     bool IsSubs(id_type p_nPublicationId, id_type p_nSectionNumber, id_type p_nLanguageId) const;  
    609 615     bool NoKeywords() const  
    610 616     {  
    637 643         return subs_res;  
    638 644     }  
      645     lint SubsTimeUnits() const  
      646     {  
      647         return nSubsTimeUnits;  
      648     }  
    639 649     bool AddUser() const  
    640 650     {