<commit_before><%! from django.utils.translation import ugettext as _ %>

<%inherit file="base.html" />

<%block name="title">${_("My Courses")}</%block>
<%block name="bodyclass">is-signedin index dashboard</%block>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>

<%block name="jsextra">
<script type="text/javascript">
    $(document).ready(function () {

        // showing/hiding creation rights UI
        $('.show-creationrights').click(function(e){
            (e).preventDefault();
            $(this).closest('.wrapper-creationrights').toggleClass('is-shown').find('.ui-toggle-control').toggleClass('current');
        });

        var reloadPage = function () {
            location.reload();
        };

        var showError = function ()  {
            $('#request-coursecreator-submit').toggleClass('has-error').find('.label').text('Sorry, there was error with your request');
            $('#request-coursecreator-submit').find('.icon-cog').toggleClass('icon-spin');
        };

        $('#request-coursecreator').ajaxForm({error: showError, success: reloadPage});

        $('#request-coursecreator-submit').click(function(e){
          $(this).toggleClass('is-disabled is-submitting').find('.label').text('Submitting Your Request');
        });
    });
</script>
</%block>

<%block name="content">
<div class="wrapper-mast wrapper">
  <header class="mast has-actions">
    <h1 class="page-header">${_("My Courses")}</h1>

    % if user.is_active:
    <nav class="nav-actions">
      <h3 class="sr">${_("Page Actions")}</h3>
      <ul>
        <li class="nav-item">
          % if course_creator_status=='granted':
          <a href="#" class="button new-button new-course-button"><i class="icon-plus icon-inline"></i>
              ${_("New Course")}</a>
          <a href="#" class="button new-button course-list-modify-button"><i class="icon-wrench icon-inline"></i>
              ${_("Course List Modify")}</a>
          % elif course_creator_status=='disallowed_for_this_site' and settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL',''):
          <a href="mailto:${settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL','')}">${_("Email staff to create course")}</a>
          % endif
        </li>
      </ul>
    </nav>
    % endif
  </header>
</div>

<div class="wrapper-content wrapper">
  % if user.is_active:
  <section class="content">
    <article class="content-primary" role="main">

      <div class="introduction">
        <h2 class="title">${_("Welcome, {0}!".format(user.username))}</h2>

        %if len(courses) > 0:
        <div class="copy">
          <p>${_("Here are all of the courses you currently have access to in Studio:")}</p>
        </div>

        %else:
        <div class="copy">
          <p>${_("You currently aren't associated with any Studio Courses.")}</p>
        </div>
        %endif
      </div>

      % if course_creator_status=='granted':
      <div class="wrapper-create-element wrapper-create-course">
        <form class="create-course course-info" id="create-course-form" name="create-course-form">
          <div class="wrap-error">
            <div id="course_creation_error" name="course_creation_error" class="message message-status message-status error" role="alert">
            <p>${_("Please correct the highlighted fields below.")}</p>
            </div>
          </div>

          <div class="wrapper-form">
            <h3 class="title">${_("Create a New Course")}</h3>

            <fieldset>
              <legend class="sr">${_("Required Information to Create a New Course")}</legend>

              <ol class="list-input">
                <li class="field field-inline text required" id="field-course-name">
                  <label for="new-course-name">${_("Course Name")}</label>
                  <input class="new-course-name" id="new-course-name" type="text" name="new-course-name" aria-required="true" placeholder="${_('e.g. Introduction to Computer Science')}" />
                  <span class="tip tip-stacked">${_("The public display name for your course.")}</span>
                  <span class="tip tip-error is-hiding"></span>
                </li>
                <li class="field field-inline text required" id="field-organization">
                  <label for="new-course-org">${_("Organization")}</label>
                  <input class="new-course-org" id="new-course-org" type="text" name="new-course-org" aria-required="true" placeholder="${_('e.g. MITX or IMF')}" />
                  <span class="tip tip-stacked">${_("The name of the organization sponsoring the course")}  - <strong>${_("Note: No spaces or special characters are allowed. This cannot be changed.")}</strong></span>
                  <span class="tip tip-error is-hiding"></span>
                </li>

                <li class="field field-inline text required" id="field-course-number">
                  <label for="new-course-number">${_("Course Number")}</label>
                  <input class="new-course-number" id="new-course-number" type="text" name="new-course-number" aria-required="true" placeholder="${_('e.g. CS101')}" />
                  <span class="tip tip-stacked">${_("The unique number that identifies your course within your organization")} - <strong>${_("Note: No spaces or special characters are allowed. This cannot be changed.")}</strong></span>
                  <span class="tip tip-error is-hiding"></span>
                </li>

                <li class="field field-inline text required" id="field-course-run">
                  <label for="new-course-run">${_("Course Run")}</label>
                  <input class="new-course-run" id="new-course-run" type="text" name="new-course-run" aria-required="true"placeholder="${_('e.g. 2013_Spring')}" />
                  <span class="tip tip-stacked">${_("The term in which your course will run")} - <strong>${_("Note: No spaces or special characters are allowed. This cannot be changed.")}</strong></span>
                  <span class="tip tip-error is-hiding"></span>
                </li>
              </ol>

            </fieldset>
          </div>

          <div class="actions">
            <input type="submit" value="${_('Create')}" class="action action-primary new-course-save" />
            <input type="button" value="${_('Cancel')}" class="action action-secondary action-cancel new-course-cancel" />
          </div>
        </form>
      </div>
      % endif

      %if len(courses) > 0:
      <div class="courses">
        <ul class="list-courses">
          %for course, url, lms_link, org, num, run in sorted(courses, key=lambda s: s[0].lower() if s[0] is not None else ''):
          <li class="course-item">
            <a class="course-link" href="${url}">
              <h3 class="course-title">${course}</h3>

              <div class="course-metadata">
                <span class="course-org metadata-item">
                  <span class="label">${_("Organization:")}</span> <span class="value">${org}</span>
                </span>
                <span class="course-num metadata-item">
                  <span class="label">${_("Course Number:")}</span>
                  <span class="value">${num}</span>
                </span>
                <span class="course-run metadata-item">
                  <span class="label">${_("Course Run:")}</span> <span class="value">${run}</span>
                </span>
              </div>
            </a>

            <ul  class="item-actions course-actions">
              <li class="action">
                <a href="${lms_link}" rel="external" class="button view-button view-live-button">${_("View Live")}</a>
              </li>
            </ul>
          </li>
          %endfor
        </ul>
      </div>

      %else:
      <div class="courses">
      </div>

      <div class="notice notice-incontext notice-instruction notice-instruction-nocourses list-notices">
        <div class="notice-item">
          <div class="msg">
            <h3 class="title">${_("Are you staff on an existing Studio course?")}</h3>
            <div class="copy">
              <p>${_('You will need to be added to the course in Studio by the course creator. Please get in touch with the course creator or administrator for the specific course you are helping to author.')}</p>
            </div>
          </div>
        </div>

        %if course_creator_status == "granted":
        <div class="notice-item has-actions"><commit_msg>Only Administrators have permission to create courses.<commit_after><%! from django.utils.translation import ugettext as _ %>

<%inherit file="base.html" />

<%block name="title">${_("My Courses")}</%block>
<%block name="bodyclass">is-signedin index dashboard</%block>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>

<%block name="jsextra">
<script type="text/javascript">
    $(document).ready(function () {

        // showing/hiding creation rights UI
        $('.show-creationrights').click(function(e){
            (e).preventDefault();
            $(this).closest('.wrapper-creationrights').toggleClass('is-shown').find('.ui-toggle-control').toggleClass('current');
        });

        var reloadPage = function () {
            location.reload();
        };

        var showError = function ()  {
            $('#request-coursecreator-submit').toggleClass('has-error').find('.label').text('Sorry, there was error with your request');
            $('#request-coursecreator-submit').find('.icon-cog').toggleClass('icon-spin');
        };

        $('#request-coursecreator').ajaxForm({error: showError, success: reloadPage});

        $('#request-coursecreator-submit').click(function(e){
          $(this).toggleClass('is-disabled is-submitting').find('.label').text('Submitting Your Request');
        });
    });
</script>
</%block>

<%block name="content">
<div class="wrapper-mast wrapper">
  <header class="mast has-actions">
    <h1 class="page-header">${_("My Courses")}</h1>

    % if user.is_active:
    <nav class="nav-actions">
      <h3 class="sr">${_("Page Actions")}</h3>
      <ul>
        <li class="nav-item">
          % if user.is_superuser:
          <a href="#" class="button new-button new-course-button"><i class="icon-plus icon-inline"></i>
              ${_("New Course")}</a>
          <!--<a href="#" class="button new-button course-list-modify-button"><i class="icon-wrench icon-inline"></i>
              ${_("Course List Modify")}</a>-->
          % elif course_creator_status=='disallowed_for_this_site' and settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL',''):
          <a href="mailto:${settings.MITX_FEATURES.get('STUDIO_REQUEST_EMAIL','')}">${_("Email staff to create course")}</a>
          % endif
        </li>
      </ul>
    </nav>
    % endif
  </header>
</div>

<div class="wrapper-content wrapper">
  % if user.is_active:
  <section class="content">
    <article class="content-primary" role="main">

      <div class="introduction">
        <h2 class="title">${_("Welcome, {0}!".format(user.username))}</h2>

        %if len(courses) > 0:
        <div class="copy">
          <p>${_("Here are all of the courses you currently have access to in Studio:")}</p>
        </div>

        %else:
        <div class="copy">
          <p>${_("You currently aren't associated with any Studio Courses.")}</p>
        </div>
        %endif
      </div>

      % if course_creator_status=='granted':
      <div class="wrapper-create-element wrapper-create-course">
        <form class="create-course course-info" id="create-course-form" name="create-course-form">
          <div class="wrap-error">
            <div id="course_creation_error" name="course_creation_error" class="message message-status message-status error" role="alert">
            <p>${_("Please correct the highlighted fields below.")}</p>
            </div>
          </div>

          <div class="wrapper-form">
            <h3 class="title">${_("Create a New Course")}</h3>

            <fieldset>
              <legend class="sr">${_("Required Information to Create a New Course")}</legend>

              <ol class="list-input">
                <li class="field field-inline text required" id="field-course-name">
                  <label for="new-course-name">${_("Course Name")}</label>
                  <input class="new-course-name" id="new-course-name" type="text" name="new-course-name" aria-required="true" placeholder="${_('e.g. Introduction to Computer Science')}" />
                  <span class="tip tip-stacked">${_("The public display name for your course.")}</span>
                  <span class="tip tip-error is-hiding"></span>
                </li>
                <li class="field field-inline text required" id="field-organization">
                  <label for="new-course-org">${_("Organization")}</label>
                  <input class="new-course-org" id="new-course-org" type="text" name="new-course-org" aria-required="true" placeholder="${_('e.g. MITX or IMF')}" />
                  <span class="tip tip-stacked">${_("The name of the organization sponsoring the course")}  - <strong>${_("Note: No spaces or special characters are allowed. This cannot be changed.")}</strong></span>
                  <span class="tip tip-error is-hiding"></span>
                </li>

                <li class="field field-inline text required" id="field-course-number">
                  <label for="new-course-number">${_("Course Number")}</label>
                  <input class="new-course-number" id="new-course-number" type="text" name="new-course-number" aria-required="true" placeholder="${_('e.g. CS101')}" />
                  <span class="tip tip-stacked">${_("The unique number that identifies your course within your organization")} - <strong>${_("Note: No spaces or special characters are allowed. This cannot be changed.")}</strong></span>
                  <span class="tip tip-error is-hiding"></span>
                </li>

                <li class="field field-inline text required" id="field-course-run">
                  <label for="new-course-run">${_("Course Run")}</label>
                  <input class="new-course-run" id="new-course-run" type="text" name="new-course-run" aria-required="true"placeholder="${_('e.g. 2013_Spring')}" />
                  <span class="tip tip-stacked">${_("The term in which your course will run")} - <strong>${_("Note: No spaces or special characters are allowed. This cannot be changed.")}</strong></span>
                  <span class="tip tip-error is-hiding"></span>
                </li>
              </ol>

            </fieldset>
          </div>

          <div class="actions">
            <input type="submit" value="${_('Create')}" class="action action-primary new-course-save" />
            <input type="button" value="${_('Cancel')}" class="action action-secondary action-cancel new-course-cancel" />
          </div>
        </form>
      </div>
      % endif

      %if len(courses) > 0:
      <div class="courses">
        <ul class="list-courses">
          %for course, url, lms_link, org, num, run in sorted(courses, key=lambda s: s[0].lower() if s[0] is not None else ''):
          <li class="course-item">
            <a class="course-link" href="${url}">
              <h3 class="course-title">${course}</h3>

              <div class="course-metadata">
                <span class="course-org metadata-item">
                  <span class="label">${_("Organization:")}</span> <span class="value">${org}</span>
                </span>
                <span class="course-num metadata-item">
                  <span class="label">${_("Course Number:")}</span>
                  <span class="value">${num}</span>
                </span>
                <span class="course-run metadata-item">
                  <span class="label">${_("Course Run:")}</span> <span class="value">${run}</span>
                </span>
              </div>
            </a>

            <ul  class="item-actions course-actions">
              <li class="action">
                <a href="${lms_link}" rel="external" class="button view-button view-live-button">${_("View Live")}</a>
              </li>
            </ul>
          </li>
          %endfor
        </ul>
      </div>

      %else:
      <div class="courses">
      </div>

      <div class="notice notice-incontext notice-instruction notice-instruction-nocourses list-notices">
        <div class="notice-item">
          <div class="msg">
            <h3 class="title">${_("Are you staff on an existing Studio course?")}</h3>
            <div class="copy">
              <p>${_('You will need to be added to the course in Studio by the course creator. Please get in touch with the course creator or administrator for the specific course you are helping to author.')}</p>
            </div>
          </div>
        </div>

        % if user.is_superuser:
        <div class="notice-item has-actions">
{'fraction_non_alphanumeric': 0.17907479969588866, 'fraction_numerical': 0.003041113515410258, 'mean_word_length': 2.428915179466613, 'pattern_counts': {'":': 1, '<': 344, '<?xml version=': 0, '>': 348, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5252123', 'n_tokens_mistral': 5069, 'n_tokens_neox': 4873, 'n_words': 1106}